image Microsoft Ignite – The tour in Amsterdam Reading bar codes from PDF documents and it’s challenges

Advanced load testing with Websurge

Load testing your web applications and services is an essential part of modern web development. There are many tools that can help you with that, for example Azure DevOps or Apache JMeter.

I am about to show you another tool, that you can run from your Windows PC. The tool is calledWebsurge and it’s build by Rick Strahl, who is a well known authority and a Microsoft MVP.

In essence, Websurge is a load testing tool for web applications. It comes as a Windows desktop application (with command-line engine) and is build with .NET Framework 4.5. Websurge is also open source!

If you go to the Websurge web site, you can read a lot about it. There is also a video which demonstrates the tool in more detail. My intention with this article is not to describe how it works, but to show you how I use it or what a potential use case would be. Before I continue, I should also mention, that WebSurge is free for personal use, but you should buy the professional version if you use it commercially (support the author!).

OK, so I started to play with Websurge few months ago. Installation and basic usage is pretty straight forward. I setup a .NET Core application to IIS on my local PC and experiment with Websurge. It’s an easy way to get familiar with the tool and after some time questions started to emerge in my head. Below are some questions I would like to elaborate on.

1. How to import a bunch of URLs to load test?

You can add HTTP requests to Websurge manually. But that is not very efficient on the long run. Tool comes with “WebSurge URL caption” module where you can navigate through your Web application or REST API and capture HTTP requests.

WebSurge Url capture tool, to generate a .websurge file of HTTP requests you want to load test.
Figure 1: WebSurge Url capture tool, to generate a .websurge file of HTTP requests you want to load test.
A list of URL to load test after the capture.
Figure 2: A list of URL to load test after the capture.

That’s great, but I need more. I generated my own .websurge files from a script, which connects to a database and generates REST API urls. For search endpoints I also generated the query parameters string with randomly generated but real data. This way the load tests are more similar to real requests that might hit the API. Below are the two examples of generated requests.

Get by ID requests in .websurge format, generated with script.
Figure 3: Get by ID requests in .websurge format, generated with script.
Search request in .websurge format, generated with script.
Figure 4: Search request in .websurge format, generated with script.

2. What happens if I replace local URL with remote ones (staging/production)?

The local testing is great, but real stuff happens in production. If you try to replace the requests to call remote API you are shown the pop-up below. First you need to validate, that you are the owner of the site:

You need to add web-surge.txt to your web server or #Allow: Websurge to robots.txt file.
Figure 5: You need to add web-surge.txt to your web server or #Allow: Websurge to robots.txt file.

After that you are able to run the load tests. Again, method of generating my custom .websurge file is very useful for smoke tests after the deployment or full blown load test.

3. Can I run the Websurge load testing from command-line?

You can use Websurge with CMD interface. An example is below.

Running Websurge with CMD interface.
Figure 6: Running Websurge with CMD interface.

At this stage my question was, can I put this to the release pipeline?

4. Can I run the Websurge load testing from Azure DevOps CD pipelines?

That is something I need to try. With a custom Agent host, this is probably achievable through some powershell scripting, but that is something for the next time :).

Ta-da!

About Miha
I've always been fascinated by computers. I am happy that I can work in this creative field of software development, where I can solve problems. I am also an avid cyclist :) and I love to learn...a lot!
Related Posts
  • All
  • By Author
  • By Category
  • By Tag

Leave a Reply