2015 Ignite New Zealand demo prep: Step 10

Steps:

  1. Intro
  2. VSO
  3. Docker
  4. xUnit
  5. Build
  6. Back end
  7. Selenium
  8. Docker
  9. Release Management
  10. Testing

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.

  1. Add .runsettings file
    1. Open PeopleTrackerWebService solution
    2. Right click on PeopleTracker.UITests
    3. Select Add / New Item…
    4. Select XML File and name it bvt.runsettings
    5. Replace the contents of the file with the code below
      <?xml version="1.0" encoding="utf-8"?>
      <RunSettings>
         <TestRunParameters> 
            <Parameter name="webAppUrl" value="http://localhost:50235/" /> 
            <Parameter name="browser" value="ie" /> 
         </TestRunParameters> 
      </RunSettings>
    6. Right-click on bvt.runsettings and select Properties
    7. Change Copy to Output Directory to Copy Always
    8. Commit and Push your changes

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.

  1. Edit your release definition
    1. Select the Dev environment
    2. Click Add tasks
    3. Add the Visual Studio Test task from the Test section
    4. Click the Visual Studio Test task
    5. Set Test Filter criteria to

TestCategory=UI

    1. Browse to the bvt.runsettings file
    2. Set Override TestRun Parameters  to
    3. 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.

Now we are going to add cloud-based web performance test .  To use the cloud-based web performance test task, we have to first create a Personal Access Token.

  1. Create Personal Access Token
    1. From the upper right-hand corner, click your name and select My Profile
    2. Select the Security tab
    3. Click Add under Personal access tokens
    4. Give the access token a name
    5. Select how long you want the token to be valid
    6. Select the accounts you want to be able to access this token with
    7. Leave All scopes selected
    8. Click Create Token
    9. Copy the token value

You can now return to your release to add the cloud-based web performance test task with your new Service Endpoint.

  1. Configure QA environment
    1. Select the QA environment
    2. Click Add tasks
    3. Add the Cloud-based Web Performance Test from the test section
    4. Click Manage next to Registered connection
    5. From the New Service Endpoint menu select Generic
    6. Enter Web Performance Test for the Connection Name
    7. Enter your VSTS url for the Server URL
    8. https://[yourAccount].visualstudio.com
    9. Enter your VSTS user name
    10. Paste your Personal Access Token into the Password/Token Key textbox
    11. Click OK
    12. Return to your release definition and click the refresh button next to Registered connection
    13. Select the connection we just created
    14. Enter your Docker host FQDN for Website URL
    15. Enter a name for the Test Name
    16. Save and start a release

When your release runs, it will run a Selenium test and a cloud-based web performance test.  The results of your Selenium test will be shown in the Release Summary under Test Results. 

However, to see the results of your Web Performance Test, we have to visit the Load test hub.

I hope you enjoyed learning about the power of the DevOps offering from Microsoft with this series.  These tools can be used to build and deploy any language to any platform.

Now I will start working on my 2016 demo where I will add more operations-focused processes such as Infrastructure as Code and Application Insights.

Pingbacks and trackbacks (18)+

Add comment

Loading