VSTS load test one run per data row

I have a datadriven unit test which reads from an access database and execute for all rows in the database.When I add this to a load test and execute with 5 concurrent users,all the records in the databse are executed 5 times.the problem I face here is when there are more records in the database the test takes more time for execution.instead is there a way to restrict a test to execute only one data row?

14.10.2009 01:03:15

Are you trying to just run the test one time per row in the database and then stop? If so, you should probably avoid using your web test as a load test.

I think you have two options but I don't have my work computer in front of me to confirm.

Option 1: Create the web test like you've already done including wiring it up to the access database like you probably already have. Then convert the test to a coded web test. And change the code so that it runs once for each record in the datasource (in other words, add an outer loop to the coded webtest).

Option 2: Edit your local test run config to run the test N number of times. From the main menu go to Test/Edit Test Run Configurations, choose your test config, Select Web Test from the left pane, then change Fixed Run Count to 5. I can't confirm this right now but I believe each time the test runs it will advance to the next record as opposed to staying on the first.

14.10.2009 01:24:16

I assume you only want data tests to run when there is a row of data available.

I would change the data driving the test to read a stored procedure with an atomic transation such as this SQL code:



SET @Id = (SELECT top 1 ID from #TestData WHERE TestRun = 0)
SELECT top 1 * FROM #TestData WHERE ID = @Id
UPDATE #TestData SET TestRun = 1 WHERE ID = @ID


This will get you a unique datarow each time the test is run, allowing the test to be used in a load test.

You will have to use SQL Express instead of access as I don't think it can handle the concurrency so well (open to correction here).

If you need more control over what happens during the load test, consider creating a load test plugin that will allow you to implement code from the following load test events:

  • LoadTestStarting
  • LoadTestFinished
  • LoadTestWarmupComplete
  • TestStarting
  • TestFinished
  • ThresholdExceeded
  • HeartBeat
  • LoadTestAborted
15.10.2009 20:55:49

later I figured out the test iterations property of the scenario in a load test to control the number of times you want to run a test for each user.

in the run settings,set Use test iterations = true test iterations = xxx(the number of iterations you need)

also to have pause between each iterations, in the scenario properties of you load test,set the below properties

1)Think Profile = On 2)Think Time between test iterations = 1

28.01.2010 06:31:18