Web Tests supports Data Driven capabilities. Data Driven Web Tests are Web Tests that are bind to a data source in order to use different data throughout the test execution.
An Example
You might record a web test that validates the login process. When you record it, the web test recorder will record the username and password you entered during the recordings. This will allow you to test your application against only a single user - the one that you recorded. However, you would probably want to validate the login test with other users. So you have two options:
- For each user create a new login test.
- Use data binding.
The first option is not really an option - so I will not elaborate about it.
The second one is what I call a Data Driven Web Test.
Web Test allows you to add data source to a web test. The Data source can be SQL, XML, and Excel. You can do that by simply create a connection to that data source:
Once you created the data source you can now use it and bind your requests to it.
Data Source Method
The thing I want to talk about is the Access Method to that data source.
When you bind it your can select whether to use:
There is a different definition for each according to the way your test lab is built. Load test supports a single machine (local controller) configuration and Rig (multiple agent machine that generate load) configuration.
Sequential
Single machine - When we select to use sequential, it tells the web test to start with the first row then fetch rows in order from the data source. When it reaches the end of the data source, loop back to the beginning and start again. It will continue until the load test completes.
Rig - This works that same as if you are on single machine. Each agent receives a full copy of the data and each starts with row 1 in the data source. Then each agent will run through each row in the data source and continue looping until the load test completes.
Random
Single Machine - When we select to use random, it tells the test to choose rows at random. Continue until the load test completes.
Rig - This also works the same as if you run the test on one machine. Each agent will receive a full copy of the data source and randomly select rows.
Unique
Single machine - When we select to use unique, it tells the test to start with the first row and fetch rows in order. Once every row is used, stop the web test.
NOTE: If this is the only web test in the load test, then the load test will stop.
Rig – This one works a little differently. Each row in the data source will be used once. So if you have 3 agents, the data will be spread across the 3 agents and no row will be used more than once.
NOTE: Once every row is used, the web test will stop executing.