locked
Load test virtual users RRS feed

  • Question

  • Hi,

    I have 3 questions:

    1- I am writting some code in a load test plugin in a "Teststarting" event, and i want to log in a file, which virtual user started each iteration and when, so how can i know or access the virtual user by code?

    2- What is the difference between "TestStarting" event in the loadtest plugin and "Prewebtest" event of the webtest plugin?

    3- What is the difference between "TestFinished" event in the loadtest plugin and "Postwebtest" event of the webtest plugin?

    Thanks

    Tuesday, March 20, 2012 7:33 PM

Answers

  • The links provided to Sean's blog has a good explanation, as well as the MSDN links to the load test events.

    I need to ammend a few items that Tim has called out , as these are often confused.

    The main thing to note is that LoadTest events only fire in a load test, and they fire on the Test Agent machine(s), whereas the WebTest events fire whether you are in a load test or not. Also, Load Test events can influence all tests that are running on the agent, where a WebTest is only the scope of its indiviudal test. Load Test events will fire regardless of the type of test, for example you can have a load test that contains Unit Test and WebTests. In that case, the only place you have a PreWebTest event is in the WebTest, there are other events that Unit Tests have that are similar.

    Here are the events pertaining to this discussion and explanation:

    LoadTest:

    1. TestStarting: This event is raised just prior to whenever a test iteration for a virtual user is starting. It will happen every time an iteration occurs for each VUser.
    2. TestFinished: This event is raised after a test iteration has completed, and it will fire at the end of each iteration for the Vuser.
    3. LoadTestStarted: This event is raised when the load test starts, it will only happen once on each agent, and before any test iterations are started.
    4. LoadTestFinished: This event is raised when the load test completes, it wil happen only once on each agent at the conclusion of all tests.

    WebTest (aka Web Performance Test):

    1. PreWebTest: This event is raised at the beginning of each webtest iteration, before any requests are made.
    2. PostWebTest: This event is rasied at the end of each webtest iteration.

    http://blogs.msdn.com/rogeorge

    • Marked as answer by MHSK Thursday, March 22, 2012 8:40 AM
    Wednesday, March 21, 2012 5:26 PM

All replies

  • Hi MHSK,

    In the LoadTest Plugin, on the TestStarting event, you can access the argument e.UserContext.UserId to find out which VUser is going to run that test iteration.

    You can also view the Details of the load test after the test run, and there is a graphical representation of the test run, along with which Vuser ran what test presented there. http://msdn.microsoft.com/en-us/library/ff183349.aspx

    How To Create LoadTest Plugin:

    http://msdn.microsoft.com/en-us/library/ms243153(v=vs.100).aspx

    The Load Test events are further explained in this blog along with more examples:

    http://blogs.msdn.com/b/slumley/archive/2009/04/10/load-test-plug-ins.aspx


    http://blogs.msdn.com/rogeorge

    Tuesday, March 20, 2012 7:55 PM
  • Thanks very much rogeorge,

    But could you please guide me about question No. 2 and 3.

    Thanks

     
    Wednesday, March 21, 2012 8:22 AM
  • 2- What is the difference between "TestStarting" event in the loadtest plugin and "Prewebtest" event of the webtest plugin?

    TestStarting is a Load Test event you can subscribe to and it will fire once per load test

    Prewebtest is a webtest plugin.  a load test is typically made up of one or many web tests.  this event will fire each time the web test is started (each iteration) therefore it will fire multiple times per load test assuming your load test runs multiple iterations)

    3- What is the difference between "TestFinished" event in the loadtest plugin and "Postwebtest" event of the webtest plugin?

    Similar to above:

    TestFinishedis a Load Test event you can subscribe to and it will fire once per load test - when the load test completes.  I believe if you are running on multiple agents it will fire once per agent

    Postwebtest is a webtest plugin.    this event will fire each time the web test is completed (after each iteration) therefore it will fire multiple times per load test assuming your load test runs multiple iterations)


    Tim

    Wednesday, March 21, 2012 3:26 PM
  • The links provided to Sean's blog has a good explanation, as well as the MSDN links to the load test events.

    I need to ammend a few items that Tim has called out , as these are often confused.

    The main thing to note is that LoadTest events only fire in a load test, and they fire on the Test Agent machine(s), whereas the WebTest events fire whether you are in a load test or not. Also, Load Test events can influence all tests that are running on the agent, where a WebTest is only the scope of its indiviudal test. Load Test events will fire regardless of the type of test, for example you can have a load test that contains Unit Test and WebTests. In that case, the only place you have a PreWebTest event is in the WebTest, there are other events that Unit Tests have that are similar.

    Here are the events pertaining to this discussion and explanation:

    LoadTest:

    1. TestStarting: This event is raised just prior to whenever a test iteration for a virtual user is starting. It will happen every time an iteration occurs for each VUser.
    2. TestFinished: This event is raised after a test iteration has completed, and it will fire at the end of each iteration for the Vuser.
    3. LoadTestStarted: This event is raised when the load test starts, it will only happen once on each agent, and before any test iterations are started.
    4. LoadTestFinished: This event is raised when the load test completes, it wil happen only once on each agent at the conclusion of all tests.

    WebTest (aka Web Performance Test):

    1. PreWebTest: This event is raised at the beginning of each webtest iteration, before any requests are made.
    2. PostWebTest: This event is rasied at the end of each webtest iteration.

    http://blogs.msdn.com/rogeorge

    • Marked as answer by MHSK Thursday, March 22, 2012 8:40 AM
    Wednesday, March 21, 2012 5:26 PM
  • Great stuff in one spot - it would make a good blog post.

    Tim

    Wednesday, March 21, 2012 8:28 PM
  • Thanks All,

    I just want to confirm something that if i have a load test that contains a single web test, and if i implemented the 2 events "TestStarting" and "PreWebTest" with a code, so both of them will be fired prior to each test iteration for each virtual user. 

    so they will be the same in this case.

    Thursday, March 22, 2012 8:40 AM
  • Hello All,

    We got new requirment for collecting some of the unix based server Statistics through VS2010 Load test.

    Can you please suggest how can we monitor UNIX counters thorugh VS2010 Load test.

    Thanks,
    Naveen
    Thursday, March 22, 2012 12:18 PM