Configure your load test against different URL’s within your Release Pipeline

Yesterday I was preparing some demo’s for my NDC talk in June.  have a simple website that  deploy to Azure by using the Build and Release Pipeline functionality. I thought it would be great to run a Cloud Based Load Test as part of this pipeline and that is what I tried to do.

I found this great blog post that explains perfectly how to set this up. Especially take notice that you have to add your own visualstudio account as a Generic Endpoint.

image

After I set up my endpoint, I created a Release Pipeline, in which I deploy a a Azure Website. (Great explanation here). I created a build and a simple release definition that deploys my website to Azure.

image

That works fine. Then I added some load tests to my solution and made sure I added them as a build artefact, as well as the runsettings file.

image

After that I added, the Cloud Based Load Test and configured it to run my SimpleLoadTest.loadtest.

image

After running this release, the deployment went fine, but the load test ran against my localhost..

Furthermore, I want the url to change in every environment. So in my Test environment I want to run against xyz-TEST.azurewebsite.net and in Production against xyz.azurewebsites.net.

When looking in my Visual Studio Solution, I saw that the web tests that I run as part of the load test are configured to run against my localhost. This is done by the value of the context parameter that is responsible for replacing the webserver in a convenient way.

image

The load test has no URL configured so it uses the URL of the web tests. If you DO want to configure the URL on the Load Test, you need to add a Context Parameter to the Load Test as well. How to do this, is described here.

When you add the Context Parameter, make sure you call it the same as you do in the web tests. Set the value of the parameter to __URLUnderTest__ (or something else with 2 underscores in front and end)

image

Why? Because you can then benefit from a great build step that can be added from the Market Place, created by Colin Dembovsky. The Replace Tokens build step.

When you add this task from the Visual Studio Marketplace (found here). You can then add this to your pipeline, you can configure it to look at the .loadtest files.

image

Then, add a Environment variable with the same name as the Context Parameter, in our case URLUnderTest.

image.

You can configure this variable differently for every environment.

If you now run the Release, it will run the Load Test against the configured URL. You can find the results in the Test / Load Test Tab

image

Hope this helps!

Resources

https://blogs.msdn.microsoft.com/visualstudioalm/p/cltbuildtaskhelp/

https://blogs.msdn.microsoft.com/visualstudioalm/2015/06/12/deploying-an-azure-web-site-using-the-new-build-system-in-visual-studio-online/

https://msdn.microsoft.com/en-us/library/ff406971.aspx

http://www.colinsalmcorner.com/post/config-per-environment-vs-tokenization-in-release-management

https://github.com/colindembovsky/cols-agent-tasks/tree/master/Tasks/ReplaceTokens

https://marketplace.visualstudio.com/items?itemName=colinsalmcorner.colinsalmcorner-buildtasks

Advertisements

Trackbacks/Pingbacks

  1. Visual Studio – Developer Top Ten for June 1st, 2016 - Dmitry Lyalin - June 2, 2016

    […] Configure your load test against different URL’s within your Release Pipeline by Rene van Osnabrugge […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: