Forum Discussion

Mpeterson's avatar
Mpeterson
Occasional Contributor
14 years ago

I cannot seem to trigger a stored proc (sql) and feed the data to DDT.Driver

 


In my datadriven testing I have many tables and I have been building a temp table and directing my test engine to use it like this:


// Creates ADO connection

aCon = ADO.CreateConnection();



 


// Sets up the connection parameters


aCon.ConnectionString = "Provider=MSDASQL.1;Password=XXXXX;Persist Security Info=True;User ID=Mark;Data Source=test;Initial Catalog=test";


 


// Opens the connection

 



aCon.Open();


 


 


 


Driver = DDT.ADODriver(aCon,"myTempTable") //The table the driver looks at



Works fine, but now I want to eliminate the temp table ( and the step of creating it) so I am now addressing the stored proc directly and getting data back. I can address each column in the table individually and all of the 147 columns are there. However I cannot seem to place them in an object ( or array) or something usable by the DDT.Driver method to be able to step through the rows of data (each row being the test perameters)

This what I have been using so far:



function TestProc()



{


var DSet;


 


// Create the new IAQAADODataset object


DSet = ADO.CreateADODataSet();


// Specify the connection string


DSet.ConnectionString = "Provider=MSDASQL.1;Password=XXXXXX;Persist Security Info=True;User ID=Mark;Data Source=test;Initial Catalog=test";


// Specify the command type and text


DSet.CommandType = cmdStoredProc;


DSet.CommandText = "BoardPlan";


// Open the dataset


DSet.Open();


// Process records of the BoardPlan Stored Proc


DSet.First();


while (! DSet.EOF)


{


 


 


Log.Message(DSet.FieldCount)// Insert data into the test log


Log.Message(DSet.FieldByName("Report Name").Value, DSet.FieldByName("Test_Line").Value);     //Test_Line does not return....


 


DSet.Next();


};


DSet.Close();


}







I do not want to adress each column my name and an '*' is not acepted. I need to be able to put all of the returned columns,147 in this case, and all rows, 100 or so, into something that  can loop though either using DDT Driver (perfered) or something similar.

Idea's or a better direction?



Thaks for looking at this,

Mark

1 Reply


  • Hi Mark,





    DDT Drivers feature does not work with stored procedures. However, when calling a stored procedure in the way you do it now, you can loop through the records.





    Another option is to convert the obtained record set to a project variable of the Table type and then work with this variable in your tests. Please find information on Table variables in the Variables of the Table Type and Iterator Object help topics.