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.
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.
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.
After that I added, the Cloud Based Load Test and configured it to run my SimpleLoadTest.loadtest.
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.
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)
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.
Then, add a Environment variable with the same name as the Context Parameter, in our case URLUnderTest.
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
Hope this helps!
Resources
https://blogs.msdn.microsoft.com/visualstudioalm/p/cltbuildtaskhelp/
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
Trackbacks/Pingbacks
[…] Configure your load test against different URL’s within your Release Pipeline by Rene van Osnabrugge […]