Retrieve values from Database in a list
Posted: Tue Mar 11, 2014 9:57 am
Hi there,
First, sorry if this question / information already exists, I didn't find it so far.
My problem is the following:
I want to retrieve values from a table in a database and store these values in a IList. In this way, I created a DataSource of type DB with a Query like this one: "Select Table.Field from Table". Then, I created a module variable in a script module and I assigned the DataSouce to the test case containing that script module. I noticed that my Test Suite runs OK, but it repeats the test case containing the script module as many times as the number of the records retrieved from database, each time for a different value. This scenario might be very useful in some circumstances but, in my case, I need the values from database to be retrieved in a list at once, in order to manipulate all the values in a single test case iteration. I tried to modify the type of the module variable mapped to the datasource from String (which is default) to IList<String> but it didn't worked throwing the well known "Cannot implicitly convert type 'System.Collections.Generic.IList<string>' to 'string' (CS0029)".
Does anyone have any idea how to do that?
Thank You
First, sorry if this question / information already exists, I didn't find it so far.
My problem is the following:
I want to retrieve values from a table in a database and store these values in a IList. In this way, I created a DataSource of type DB with a Query like this one: "Select Table.Field from Table". Then, I created a module variable in a script module and I assigned the DataSouce to the test case containing that script module. I noticed that my Test Suite runs OK, but it repeats the test case containing the script module as many times as the number of the records retrieved from database, each time for a different value. This scenario might be very useful in some circumstances but, in my case, I need the values from database to be retrieved in a list at once, in order to manipulate all the values in a single test case iteration. I tried to modify the type of the module variable mapped to the datasource from String (which is default) to IList<String> but it didn't worked throwing the well known "Cannot implicitly convert type 'System.Collections.Generic.IList<string>' to 'string' (CS0029)".
Does anyone have any idea how to do that?
Thank You