locked
Load test with Think profile, system is applying the thinktime in the beginning of the run. RRS feed

  • Question

  •  

    Issue: If we are declaring a load test with Think profile, system is applying the thinktime in the beginning of the run.

     

    Detail: We have a load test using Unit Test with following configuration

    Think time= 1 hr

    Step load

    Max. Users= 100

    Step duration: 10 sec.

    Step User count : 1

     

                    Once we start the Test using VSTS 2008, the system is waiting for 1 hr, mean time all the users getting initialized and ready to start the test.

                    At the end of 1 hr, all users start the test at once, against the expected step pattern.


    Because of this, we need to wait 1 hr to get the first request executed. 
     

    This issue is not there in VSTS 2005, where the thinktime is applying only after the first iteration.

     

    Do you have any solution for this ?

    Thanks
    Ambily


    IT Analyst
    Thursday, December 18, 2008 8:21 AM

Answers

  • If you are referring to the setiting for "Think Time Between Test Iterations" on a Scenario in a load test (rather than the ThinkTime property on a Web test request), then I think this is a bug in VSTS 2008.      This will be fixed in the next major release of VSTS, but is not fixed in VSTS 2008 SP1.    However, in VSTS 2008 SP1, there were enhancements to the load test plug-in API that are described in my blog post here http://blogs.msdn.com/billbar/pages/load-test-api-enhancements-in-vsts-2008-sp1-beta.aspx.    You can ignore most of the stuff in the blog post about setting the load profile, because all you need to set is the new DelayBetweenIterations property on the LoadTestScenario object.   So, in the load test editor, you can set the "Think Time Between Test Iterations" to 0 so that tests will start immediately, but then override the value in your load test plug-in code, but not until the first test finished.   A LoadTestPlugin that does this would look like this (this assumes you only have one Scenario defined in the LoadTest; if not, you'll need to change the reference to m_loadTest.Scenarios[0] to find the correct scenario using the ScenarioName passed in on the TestFinishedEventArgs):

    using System;  
    using Microsoft.VisualStudio.TestTools.LoadTesting;  
     
    namespace TestProject1  
    {  
        public class LoadTestPluginExample : ILoadTestPlugin  
        {  
            private LoadTest m_loadTest;  
            public void Initialize(LoadTest loadTest)  
            {  
                m_loadTest = loadTest;  
                loadTest.TestFinished += new EventHandler<TestFinishedEventArgs>(loadTest_TestFinished);  
            }  
     
            void loadTest_TestFinished(object sender, TestFinishedEventArgs e)  
            {  
                m_loadTest.Scenarios[0].DelayBetweenIterations = 3600;  
            }  
        }  
    • Proposed as answer by Bill Barnett - MSFTModerator Thursday, December 18, 2008 7:53 PM
    • Marked as answer by Bill.Wang Wednesday, December 24, 2008 5:25 AM
    • Unmarked as answer by Ambily Wednesday, December 24, 2008 7:45 AM
    • Marked as answer by Ambily Wednesday, December 24, 2008 7:45 AM
    Thursday, December 18, 2008 7:53 PM
    Moderator

All replies

  • Hi,

    Why not using warm-up duration?

    Please mark the replies as answers if they help and unmark them if they provide no help. My blog: blogs.microsoft.co.il/blogs/shair
    Thursday, December 18, 2008 9:58 AM
  • Hi

    Using Warm-up duration I can add some time in the begining of the run. But my requirement is different.

    My requirement is that, we need a think time in between the iteration, not in beginning. VSTS 2008 is taking the specified think time in the beginning also. 

    In VSTS 2005, if I specify a think time of 1 hr, after the first iteration it will wait for 1 hr to post the next request.
    But in VSTS 2008, it will wait for 1 hr before the first request. I want to eliminate the waiting in the beginning of the test. 
    How can I do that ?


    Hope, now the question is more clear.

    Thanks
    Ambily    
    IT Analyst
    Thursday, December 18, 2008 1:35 PM
  • Hi,

    Set 0 Think Time in the first request in all your web test, he should start right away and then wait an hour.

    Please mark the replies as answers if they help and unmark them if they provide no help. My blog: blogs.microsoft.co.il/blogs/shair
    Thursday, December 18, 2008 1:44 PM
  • If you are referring to the setiting for "Think Time Between Test Iterations" on a Scenario in a load test (rather than the ThinkTime property on a Web test request), then I think this is a bug in VSTS 2008.      This will be fixed in the next major release of VSTS, but is not fixed in VSTS 2008 SP1.    However, in VSTS 2008 SP1, there were enhancements to the load test plug-in API that are described in my blog post here http://blogs.msdn.com/billbar/pages/load-test-api-enhancements-in-vsts-2008-sp1-beta.aspx.    You can ignore most of the stuff in the blog post about setting the load profile, because all you need to set is the new DelayBetweenIterations property on the LoadTestScenario object.   So, in the load test editor, you can set the "Think Time Between Test Iterations" to 0 so that tests will start immediately, but then override the value in your load test plug-in code, but not until the first test finished.   A LoadTestPlugin that does this would look like this (this assumes you only have one Scenario defined in the LoadTest; if not, you'll need to change the reference to m_loadTest.Scenarios[0] to find the correct scenario using the ScenarioName passed in on the TestFinishedEventArgs):

    using System;  
    using Microsoft.VisualStudio.TestTools.LoadTesting;  
     
    namespace TestProject1  
    {  
        public class LoadTestPluginExample : ILoadTestPlugin  
        {  
            private LoadTest m_loadTest;  
            public void Initialize(LoadTest loadTest)  
            {  
                m_loadTest = loadTest;  
                loadTest.TestFinished += new EventHandler<TestFinishedEventArgs>(loadTest_TestFinished);  
            }  
     
            void loadTest_TestFinished(object sender, TestFinishedEventArgs e)  
            {  
                m_loadTest.Scenarios[0].DelayBetweenIterations = 3600;  
            }  
        }  
    • Proposed as answer by Bill Barnett - MSFTModerator Thursday, December 18, 2008 7:53 PM
    • Marked as answer by Bill.Wang Wednesday, December 24, 2008 5:25 AM
    • Unmarked as answer by Ambily Wednesday, December 24, 2008 7:45 AM
    • Marked as answer by Ambily Wednesday, December 24, 2008 7:45 AM
    Thursday, December 18, 2008 7:53 PM
    Moderator