- Last Updated: [[2020-12-04]] - [[Visual Studio Load Testing]] - # Using Default Web Test Plugins - Visual Studio comes with pre-written Webtest plugins that extend the functionality of webtests. To see them, right click on the webtest node and select Add Web Test Plugin. The plugins available are: - Generate GUID - Generate Random Integer - useful for randomizing text - Generate Saml Token - Generate Date Time Plugin - useful for including the timestamp or passing date/time parameters in the request. The date format is editable. - # Using Custom Web Test Plugins - Create a new class : Right click on the project node and click Add New Class. - Paste/write the code in the new class. The class must extend the `WebTestPlugin` class. Sample code below: - ```c# using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.VisualStudio.TestTools.WebTesting; namespace CRT { public class MoveCursorForDataSource: WebTestPlugin { public override void PreWebTest(object sender, PreWebTestEventArgs e) { base.PreWebTest(sender, e); e.WebTest.MoveDataTableCursor("users", "users#csv", e.WebTest.Context.WebTestUserId); } } }``` - The code above moves the cursor for the data source manually for greater control over when the next item in a file is read by each virtual user. For this example, it is only necessary to understand that the `WebTestPlugin` class is being extended. - Add a reference to the class created. - Right click on the References node under the project and click Add reference. - Click on `Microsoft.VisualStudio.QualityTools.WebTestFramework` and add it as a reference. - Use the plugin by right clicking on the Web Test node as usual, clicking Add Web Test Plug-in, and the class you created should be on the list as well.