-
Notifications
You must be signed in to change notification settings - Fork 291
Azure DevOps Test Execution
-
Ensure all tests are working locally prior to setting them up to run from Azure DevOps.
-
Consider how you will store credentials required to connect to the environment the tests will be performed on. Possible options:
- Update your EasyRepro project to dynamically retrieve credentials from an external source like Azure Key Vault
- Store credentials as pipeline variables and use PowerShell or another mechanism to update the .config file prior to test execution
Avoid hard coding credentials so they are not checked into source control
This will compile and run tests inside of an Azure DevOps build pipeline using a Microsoft hosted build agent.
Build Setup
- Set
Pipeline: Agent Pool
to 'Hosted VS2017' - Set
Get sources
to be the repository containing the EasyRepro solution which contains the tests to be run - Add a NuGet task (2.*)
- Execute the
restore
command - Set
Path to solution, packages.config, or project.json
to the location of the .sln, packages.config, or project.json file
- Execute the
- Add a Visual Studio Build task (1.*)
- Set
Solution
to the path of the solution or project to be built - Set the
Visual Studio Version
to 'Visual Studio 2017' - Set the
Configuration
to 'release'
- Set
- Add a Visual Studio Test Platform Installer (1.*) task
- Add a Visual Studio Test (2.*) task
- Set
Select tests using
to 'Test assemblies' - Update
Test files
to include a pattern that will find your project's compiled assembly - Ensure the
Search folder
path corresponds to the value inTest files
- Check
Test mix contains UI tests
- Set
Select test platform using
to 'Version' - Set
Test platform version
to 'Installed by Tools Installer'
- Set
This will run all tests found in the Search Folder
matching the pattern set under Test files
during a build.
This will compile and run tests inside of an Azure DevOps release pipeline using a Microsoft hosted build agent.
Build Setup
- Add steps 1-4 from Scenario #1
- Add a Publish Build Artifacts task
- Set
Path to publish
to the 'bin/release' folder of the project - Set
Artifact publish location
to 'Azure Pipelines/TFS'
- Set
Release Setup
- Add an
Artifact
that references theProject
andSource (build pipeline)
created above- Set
Default version
to 'Latest'
- Set
- Add a Stage to the pipeline if one does not exist
- Add steps 5-6 from Scenario #1
This will run all tests found in the Search Folder
matching the pattern set under Test files
during a release pipeline.
This will allow users to run individual or groups of tests ondemand from existing Test Plans, Test Suites, and/or, Test Cases found in the Azure DevOps.
Project Set
- Ensure Visual Studio is connected to your Azure DevOps instance
- Open Test Explorer and right-click on a test
- Choose
Associate to test case
- Enter the Test Case id from Azure DevOps
- Repeat for all tests
Additional documentation: https://docs.microsoft.com/en-us/azure/devops/test/associate-automated-test-with-test-case?view=azure-devops
Build Setup
The same setup can be used from Scenario #1: Executing tests inside an Azure DevOps build
Release Setup
The same setup can be used from Scenario #2: Executing tests inside an Azure DevOps release
with 1 exception.
- Add a Visual Studio Test (2.*) task
- Set
Select tests using
to 'Test run' - Update
Test files
to include a pattern that will find your project's compiled assembly - Leave
Test Run
as the default value of '$(test.RunId)' - Check
Test mix contains UI tests
- Set
Select test platform using
to 'Version' - Set
Test platform version
to 'Installed by Tools Installer'
- Set
Running from Test Plans
- Select a Test Plan, Test Suite, or 1 more more Test Cases
- Select
Run
- Select
Run for web application
- This will open a window validating the related tests, if everything passes the tests will start running in the background
- Check back after the tests complete to see the results
Additional documentation https://docs.microsoft.com/en-us/azure/devops/test/run-automated-tests-from-test-hub?view=azure-devops
The browser being tested against needs to be installed on the build agent. By default Microsoft hosted build agents do have a number of browsers supported by EasyRepro installed by default. If there are issues running tests, verify the Capabilities of the agent to ensure the version of the browser installed is compatible with the Selenium Web Driver version supported by EasyRepro.
Additional Troubleshooting