Vsts for testers Reading Notes (9)

Source: Internet
Author: User
4. Edit webtest
9. Create a webtest plug-in

• Web Test plug-in for isolation Web In the testCodeProvides a means. Custom Web The test plug-in is running Web Some code can be called during testing. In each test iteration, Web The test plug-in must run once. • From Webtestplugin The base class is derived from your own class and you can create a custom Web Test the plug-in. • You can customize Web The test plug-in is used for recorded Web Test, which allows you to obtain Web More control of the test. They can also be used for encoding Web Test.
By default, webtest does not provide a predefined webtest plug-in:

Create a webtest Plugin:
1. Create a class library project
2. Right-click and select "add reference ".

On the ". Net" tab, select "Microsoft. visualstudio. testtools. webtesting ". Click OK ".
3. Write a code for obtaining the number of tests and use the sample code provided on msdn:
Using system;
Using system. Collections. Generic;
Using system. text;
Using Microsoft. visualstudio. testtools. webtesting; namespace samplerules
{
Public class samplewebtestplugin: webtestplugin
{
Static int testiterationnumber; Public override void postwebtest (Object sender, postwebtesteventargs E)
{
} Public override void prewebtest (Object sender, prewebtesteventargs E)
{
E. webtest. Context ["testiterationnumber"] = testiterationnumber;
Testiterationnumber ++;
}
}
}
4. Build a class library and add the generated DLL file to the test project.

5. Click the set web test plug-in button again to view the mywebtestplugin

Click OK to add mywebtestplugin to the Web Test plug-in the webtest attribute:

6. After this plug-in is added, the number of test iterations will be recorded during the test.

7. Download The mywebtestplugin demo.

10. other editing functions
Select webtest and right-click to view the provided editing functions, such as manually adding requests, adding Web Service requests, and adding comments,

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.