Forum Discussion
Hi,
I want to read the data from csv file for which we are using DDT driver.
First of all, you can parameterize requests using the CSV files without scripting at all. For this purpose, you can use the database variables that can read the values from different data storages, for example from CSV files. Note that using these variables requires both the correct connection string for accessing the needed file (you can find examples of the connection strings on the following page http://www.connectionstrings.com/textfile) and the necessary value access type (for example, Next value on each use, or Next value on each use by a virtual user, or Next value on each use within a station, or another type that corresponds to your file).
For example, you can create one database variable for the column that stores logins, and another variable for the passwords column. Then, you just specify the names of these variables in the corresponding parameters of the request that simulates login. After that, if you run the test, virtual users will use the values from the CSV file in turn.
On the other hand, you can parameterize the recorded requests from scripts. This approach is described in the Modifying Traffic in Scripts help topic. In this case, the load testing task variables declared in the Tasks editor are not used at all, and access to the request parameters is implemented directly through the URLVariables, BodyVariables and Variables collections of the HTTPRequest object. In other words, you can replace the request parameter with the value from the CSV File using the following approach:
HTTPRequestObj.BodyVariables.Item("login") = DataDriverObj.Value("Login")
You can also find an example that demonstrates this approach in the Load Testing Advanced tutorial.