Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS 2010 web Load Test- Set Unique value for each Virtual User from CSV

I have 50 username and password in a CSV. I want to run a web Load Test where each Virtual user is assigned one unique value for the duration (1hr) of the load test for multiple iterations. How is this done in VS 2010 Ultimate edition.

Thanks

like image 986
kumar Avatar asked Dec 22 '22 07:12

kumar


2 Answers

Create and add a new WebTestPlugin in whose PreWebTest event you call the MoveDataTableCursor() method of the WebTest object, giving it the value of the $WebTestUserId context parameter (e.WebTest.Context.WebTestUserId). Also make sure that the Data Source is set to Do not move cursor automatically. This has the effect of locking a virtual user to a row in your data table.

CAVEAT: this will only work if you are running locally or with ONE Agent, and with only one Scenario in the LoadTest, because the WebTestUserId is NOT unique across Agents or Scenarios (contrary to the documentation). If you have a multi-Agent setup then your plugin will have to know how to split the data rows across Agents. There is no way at all to work this across multiple Scenarios -- you'd need a more clever solution for that.

Also note that WebTestUserId starts at 0 in a LoadTest but starts at 1 in a standalone WebTest (who knows why?).

like image 56
agentnega Avatar answered May 13 '23 03:05

agentnega


The caveat mentioned by @agentnega kinda got me wondering so I found this

Single Machine running tests

  • Sequential – This is the default and 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. Continue until the load test completes. In a load test, the current row is kept for each data source in each web test, not for each user. When any user starts an iteration with a given Web test, they are given the next row of data and then the cursor is advanced.

  • Random – This indicates to choose rows at random. Continue until the load test completes.

  • Unique - This indicates to start with the first row and fetch rows in order. Once every row is used, stop the web test. If this is the only web test in the load test, then the load test will stop.

Multiple machines running as a rig

  • Sequential – This works that same as if you are on one 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 - 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 - 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. As with one machine, once every row is used, the web test will stop executing.

Source http://vsptqrg.codeplex.com/

like image 30
Alex Nolasco Avatar answered May 13 '23 02:05

Alex Nolasco