Use VSTS for website stress testing

Source: Internet
Author: User

VSTS provides a rich and powerfulToolsPlatform, integratedSoftwareDevelopmentEach Role in the field covers all stages of the software development lifecycle, includingDesign, Development,Test,ManagementThe integration of this entire set of components enables it to effectively improve software development.ProcessImprove the coordination capability between different roles and improveWorkEfficiency.

This article briefly introducesHowUse VSTSWebsiteDoStress Testing.

1. Create a test project named MyTest

2. Create a WebTest

Click Web Test...
IE will pop up immediately, so that the recording script can start.

3. Enter the WebSite address to be tested in IE, for example, http: // localhost/WebSite/Default. aspx.

4. Perform some operations on the website. At this time, VSTS will record your operations for stress testing.

5. After recording the script, click "STOP"

6. Click GenerateCode, You can see the recorded code similar to the following:

//------------------------------------------------------------------------------
// <Auto-generated>
// This code was generated by a tool.
// Runtime Version: 2.0.50727.42
//
// Changes to this file may cause incorrect behavior and will be lost if
// The code is regenerated.
// </Auto-generated>
//------------------------------------------------------------------------------

Namespace MyTest
{
Using System;
Using System. Collections. Generic;
Using system. text;
Using Microsoft. visualstudio. testtools. webtesting;
Using Microsoft. visualstudio. testtools. webtesting. Rules;


Public class webtest1coded: webtest
{

Public webtest1coded ()
{
This. preauthenticate = true;
}

Public override ienumerator <webtestrequest> getrequestenumerator ()
{
Webtestrequest request1 = new webtestrequest ("http: // localhost/website/default. aspx ");
Request1.thinktime = 1688;
Extracthiddenfields rule1 = new extracthiddenfields ();
Rule1.contextparametername = "1 ";
Request1.extractvalues + = new eventhandler <extractioneventargs> (rule1.extract );
Yield return request1;

WebTestRequest request2 = new WebTestRequest ("http: // localhost/WebSite/Default. aspx ");
Request2.ThinkTime = 2;
Request2.Method = "POST ";
FormPostHttpBody request2Body = new FormPostHttpBody ();
Request2Body. FormPostParameters. Add ("_ VIEWSTATE", this. Context ["$ HIDDEN1. _ VIEWSTATE"]. ToString ());
Request2Body. FormPostParameters. Add ("Button1", "Go to Test Page ");
Request2Body. FormPostParameters. Add ("_ VIEWSTATEENCRYPTED", this. Context ["$ HIDDEN1. _ VIEWSTATEENCRYPTED"]. ToString ());
Request2Body. FormPostParameters. Add ("_ EVENTVALIDATION", this. Context ["$ HIDDEN1. _ EVENTVALIDATION"]. ToString ());
Request2.Body = request2Body;
ExtractHiddenFields rule2 = new ExtractHiddenFields ();
Rule2.ContextParameterName = "1 ";
Request2.ExtractValues + = new EventHandler <ExtractionEventArgs> (rule2.Extract );
Yield return request2;

WebTestRequest request3 = new WebTestRequest ("http: // localhost/WebSite/test. aspx ");
Request3.Method = "POST ";
FormPostHttpBody request3Body = new FormPostHttpBody ();
Request3Body. FormPostParameters. Add ("_ VIEWSTATE", this. Context ["$ HIDDEN1. _ VIEWSTATE"]. ToString ());
Request3Body. FormPostParameters. Add ("Button1", "Go to default page .");
Request3Body. FormPostParameters. Add ("_ EVENTVALIDATION", this. Context ["$ HIDDEN1. _ EVENTVALIDATION"]. ToString ());
Request3.Body = request3Body;
Yield return request3;
}
}
}

7. Add a Load Test...

8. Complete the parameters of Load Test.
 

1) The first step is to enter the scenario name.
2) The second step is to fill in the loading style
If you select a fixed number of users to Load at a time, select the first item Constant Load
If "Setp Load" is selected, it indicates step-by-step increase, setting the number of users at the start, and how long the number of users increases each time.
3) Test Mix
4) Browser Mix
5) Network Mix
6) in Counter Sets, select Add Compuer... to monitor a PC.
7) Run Settings

9. Click Finish.

10. Click Run Test. The Test starts.

After the stress test is run, we can select a parameter to view the machine'sPerformance. See:

We can also run perfmon to view various machine metrics through Performance.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.