-
Notifications
You must be signed in to change notification settings - Fork 290
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 Poolto 'Hosted VS2017' - Set
Get sourcesto be the repository containing the EasyRepro solution which contains the tests to be run - Add a NuGet task (2.*)
- Execute the
restorecommand - Set
Path to solution, packages.config, or project.jsonto the location of the .sln, packages.config, or project.json file
- Execute the
- Add a Visual Studio Build task (1.*)
- Set
Solutionto the path of the solution or project to be built - Set the
Visual Studio Versionto 'Visual Studio 2017' - Set the
Configurationto 'release'
- Set
- Add a Visual Studio Test Platform Installer (1.*) task
- Add a Visual Studio Test (2.*) task
- Set
Select tests usingto 'Test assemblies' - Update
Test filesto include a pattern that will find your project's compiled assembly - Ensure the
Search folderpath corresponds to the value inTest files - Check
Test mix contains UI tests - Set
Select test platform usingto 'Version' - Set
Test platform versionto '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 publishto the 'bin/release' folder of the project - Set
Artifact publish locationto 'Azure Pipelines/TFS'
- Set
Release Setup
- Add an
Artifactthat references theProjectandSource (build pipeline)created above- Set
Default versionto '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 usingto 'Test run' - Update
Test filesto include a pattern that will find your project's compiled assembly - Leave
Test Runas the default value of '$(test.RunId)' - Check
Test mix contains UI tests - Set
Select test platform usingto 'Version' - Set
Test platform versionto '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