I have one web test called MYWEBTEST includes: login and non-login part. I have one load test called MYLOADTEST using MYWEBTEST and 30 users (constant)

As my understand, if I run the load test, 30 users will generated 30 MYWEBTEST and each one will do login separatedly. What I am trying to achieve is to by pass the login (because at this time, I don't want to measure the login). Is there any way to factor the login part up so that 30 MYWEBTEST don't need to do the login part separatedly but they share the same login session


Bao nguyen

Re: Visual Studio Team System - Testing Login once for all in load test

Yutong MSFT

If you are using VSTS2005 (with or without sp1), check the sample code in our team blog ( You need to add code to maintain the cookie. In the PreRequest or PostRequest event handlers, cookies are stored in e.Request.Cookies. Since the code sample is written to simulate login once for each virtual user. In your case, you still need to add code to make sure the login requests are executed only once.

If you are not running tests on Rig (Controller/Agent), Orcas (VSTS Beta1) is out and ready for download from the following link The scenario 'Login once per virtual user' is a supported feature in Orcas. After you create a load test, you can edit the test mix, specify an initialize test / Terminate test for the mix, the settings apply to every test in the mix and each virtual user. In your case, you can add the login test as an initialize test, and add the other web test to the test mix. During the load test run, every virtual user will execute the login test first and only once, and execute the other test 1-n time(s), where n dependents on the Percentage of New Users property set on the scenario. Read the blog post for the VSTS2005 first. You still need to add code to handle cookie and make sure the login test is executed only once. For how to create a load test that meets your requirements and cookie handling in Orcas, please read PostID=1550804&SiteID=1.

Re: Visual Studio Team System - Testing Login once for all in load test


i ahve the same problem. I went to . But there is no clear explanation of what hte code is doing. Plesae could you explain