How to Execute a Stored Procedure from within a Test.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2010
08:29 AM
02-25-2010
08:29 AM
How to Execute a Stored Procedure from within a Test.
I am wondering how to execute a stored procedure from within a test script.
Is it as simple as puting a line in the test script like this:
DDT.ADODriver.(<connection string>, <sql syntax to execute the stored procedure>);
Is it as simple as puting a line in the test script like this:
DDT.ADODriver.(<connection string>, <sql syntax to execute the stored procedure>);
10 REPLIES 10
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2010
05:11 PM
02-25-2010
05:11 PM
Hi,
You can find an example here.
You can find an example here.
------
Yuri
TestComplete Customer Care Engineer
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Yuri
TestComplete Customer Care Engineer
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2010
06:40 AM
02-26-2010
06:40 AM
Given your example I have the following code:
SProc = ADO.CreateADOStoredProc();
SProc.ConnectionString = "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=CEA_NEIC;Data Source=<IP Address>";
SProc.ProcedureName = "CEA_NEIC.dbo.P_update_RPT_PI_Profile_Summary_Data_job";
SProc.ExecProc();
Log.Message("Result: " + SProc.Parameters.Items(1).Value);
and the test fails with a "JScript Runtime Error" and the following:
Query timeout expired
Unit: "Create_New_PI" Line: 25 Column: 3.
where line: 25 Column: 3 is the "SProc.ExecProc()'" line above.
Any help here?
Do I have to increase the timeout value for queries or something?
The actual Stored Procedure runs about 2min
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2010
09:17 PM
02-28-2010
09:17 PM
Hi,
Did you declare your procedure's parameters as it is shown in the example?
Did you declare your procedure's parameters as it is shown in the example?
------
Yuri
TestComplete Customer Care Engineer
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Yuri
TestComplete Customer Care Engineer
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2010
12:47 AM
03-01-2010
12:47 AM
My Procedure does not have any parameters. Do I still have to define them?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2010
04:20 AM
03-01-2010
04:20 AM
Hi,
Your procedure has at least one out-parameter which you use here:
You need to declare it.
Your procedure has at least one out-parameter which you use here:
Log.Message("Result: " + SProc.Parameters.Items(1).Value);
You need to declare it.
------
Yuri
TestComplete Customer Care Engineer
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Yuri
TestComplete Customer Care Engineer
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2010
04:50 AM
03-01-2010
04:50 AM
I noticed that after the comment above. When I tried to add a parameter for 'output' the system said the procedure did not have any parameters. I have subsequently changed the Log line. Also note that the error is failing on the line before the Log line- the SProc.ExecProc;
However, my issue still remains. For example if the Log line is commented out, I still receive the same error.
Adding Parameters does not fix my issue.
Other thoughts?
However, my issue still remains. For example if the Log line is commented out, I still receive the same error.
Adding Parameters does not fix my issue.
Other thoughts?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2010
09:08 PM
03-03-2010
09:08 PM
Hi Mark,
I recommend that you try specifying a timeout for your procedure (SProc.CommandTimeout = <value>). Where <value> is a timeout in seconds.
Does this help?
I recommend that you try specifying a timeout for your procedure (SProc.CommandTimeout = <value>). Where <value> is a timeout in seconds.
Does this help?
------
Yuri
TestComplete Customer Care Engineer
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Yuri
TestComplete Customer Care Engineer
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2010
12:53 AM
03-04-2010
12:53 AM
Thank you. That seemed to work.
I first tried to put in a value of 2min (as the procedure runs under 2 min) but that did not work. So I increased the time to 3min, and it returned successfully.
Again, thank you.
I first tried to put in a value of 2min (as the procedure runs under 2 min) but that did not work. So I increased the time to 3min, and it returned successfully.
Again, thank you.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2010
06:23 PM
03-04-2010
06:23 PM
We get this question a lot during TestComplete trainings and we now have a video on it available here.
-Steve
Register Now! TestComplete Keyword Online Training April 12-14th
-Steve
Register Now! TestComplete Keyword Online Training April 12-14th
