About the author

My name is Donovan Brown and I am a Principal DevOps Manager with Microsoft with a background in application development. I also run one of the Nation’s fastest growing online registration sites for motorsports events DLBRacing.com. When I am not writing software I race cars for fun. DLBRacing.com has given me the opportunity to combine my two passions writing software and racing cars.

This is the final post in the series on how I built my demo for Ignite New Zealand 2015.In this post we are going to add tests to our release definition.We are going to run Selenium and cloud-based web performance tests.

I feel the most interesting part is how we only have to write the Selenium test once but we are able to run it against and URL we like.We are going to pass in at runtime the URL we want the test to exercise.This is all controlled by a .runsettings file.Values we set in the runsettings file can be accessed by the test. We can override those values using the Visual Studio Test task in build and release.

The first thing we need to do is add a .runsettings file to your project.When we originally added the test, it was already written to use the values in the .runsettings file.

I set the values to my development environment settings.We are going to pass in the URLs for our ASP.NET 5 applications running in their Docker hosts during our release.I also wanted to control the browser used during the test execution.The value for browser needs to match one of the values in the MyTestInitialize method in our test class.

With the .runsettings file in place we can return to our release definition and add our test tasks.

Edit your release definition

Select the Dev environment

Click Add tasks

Add the Visual Studio Test task from the Test section

Click the Visual Studio Test task

Set Test Filter criteria to

TestCategory=UI

Browse to the bvt.runsettings file

Set Override TestRun Parametersto

webAppUrl=[URL to Dev Docker Host]/;browser=firefox

Make sure that whatever browser you select is actually installed on your agent or you will get an error during your release.

Repeat adding this task to the QA environment updating the webAppUrl to QA host and browser to Chrome.