Azure DevOps, Scrum, & .NET Software Leadership and Consulting Services

Introducing Slide Speaker: Videos with Voice-over from your PowerPoint and Google Slides Presentations

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.

SNAGHTML1e117e59

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.

image

7. Click OK to exit this dialog.

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

SNAGHTML1e25126f

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!

-Ben

 

— 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.

SUBSCRIBE TO THE BLOG


4 responses to “Add Simple Arithmetic to Web Performance Test & Load Tests”

  1. […] (Update August 5, 2014: The latest version now has the ability to do math as part of your web performance and load tests.) […]

  2. Pooja Avatar
    Pooja

    Thanks 🙂

  3. Niraj Avatar
    Niraj

    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

  4. Swayam Saini Avatar
    Swayam Saini

    Thanks for sharing this valuable information. whenever I read articles related to load and performance testing.

    In the world of Performance Testing and Load Testing, it’s important to understand the various types of testing, what they consist of and how they can benefit your applications.

    I am very happy with the services offered by IntelliTech Consulting for the last few months. They are always on the other end of an email or phone call with any queries we have. Contact them if you are looking for great Performance Testing results

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.