— New online course!  Azure App Services & App Service Security with ASP.NET Core — Special launch price 50% off —

Add Simple Arithmetic to Web Performance Test & Load Tests


I’ve been writing and maintaining a library of useful utilities for Visual Studio Web Performance Tests and Load Tests for a while and I got an email from a reader today asking for a new one.  She asked if there was any way to do simple math inside of a web performance test or load test.  The unfortunate answer is that there’s no good way to do that with the out-of-the-box version of the tools.  Since I’m a prodigious procrastinator, I decided to write this code and add it to my web performance test utilities.

Here are the steps to use this in your projects:

1. Download the code then extract and compile it using Visual Studio.

2. Add a reference from your Web Performance Test / Load Test Project to Benday.WebLoadTest.Utilities.dll.

3. Open one of your web performance tests

4. Right-click the step where you’d like to do some math and choose Add Extraction Rule from the context menu.


5. Choose Arithmetic from the Select a rule panel.

6. Populate the parameters and values for the rule.  The valid operations are +, –, *, and /.  All the values will be integers.  If you want to bind any of these values to a value in Test Context or in a data source, you can use the double-bracket notation – {{context-value-name}}.  By default, the rule will throw an exception if it can’t convert Value 1 or Value 2 to an integer but if you’d like a more forgiving test, set Invalid values become zero to true.


7. Click OK to exit this dialog.

8. Run your test and enjoy the math-y goodness in your Test Context.


Don’t forget about all the other validation and extraction rules that are still in this library such as Sleep, Table Column Validator, Label Value Extractor, and more!  Click here to download the code.

Looking to get up to speed on Web and Load Testing with Visual Studio?  Check out our load testing course on Pluralsight.com!



— Need some customized on-site load test training or coaching?  Want someone to set up your load tests and load testing environment?  Performance problems got you down?  Drop us a line at info@benday.com.

3 Responses to "Add Simple Arithmetic to Web Performance Test & Load Tests"
  1. Good day Ben

    being new to vsts, i’d like to email results of pass and failed transactions within a certain webtest. can you please help.

    say for example: a webtest1 contain TransactionName1,TransactionName2 and TransactionName3, each containing some requests.

    thank you sir

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.