Last active
September 23, 2020 18:37
-
-
Save nadvolod/742a5cfcaac71324beb8cc34101f3a9d to your computer and use it in GitHub Desktop.
Working implementation of an azure pipeline that runs acceptance tests in sauce labs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pool: | |
name: Hosted VS2017 | |
demands: | |
- msbuild | |
- visualstudio | |
- vstest | |
steps: | |
- script: set | |
displayName: print all variables | |
- task: NuGetToolInstaller@0 | |
displayName: 'Use NuGet 4.4.1' | |
inputs: | |
versionSpec: 4.4.1 | |
- task: NuGetCommand@2 | |
displayName: 'NuGet restore' | |
inputs: | |
restoreSolution: '**\*.sln' | |
- task: VSBuild@1 | |
displayName: 'Build solution' | |
inputs: | |
solution: '**\*.sln' | |
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactstagingdirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"' | |
logProjectEvents: true | |
- task: PowerShell@2 | |
displayName: 'Set Sauce Environment Variables' | |
inputs: | |
targetType: filePath | |
filePath: ./setEnvironmentVariables.ps1 | |
arguments: '$env:SAUCE_USER $env:SAUCE_KEY' | |
# Using powershell ##vso command to set an environment variable in the system | |
- powershell: | | |
Write-Host "Sauce Username stored in ADO variables is=>$($env:SAUCE_USER)"; | |
Write-Host "Sauce Access Key stored in ADO variables is=>$($env:SAUCE_KEY)"; | |
Write-Host "Sauce Username stored in Env variables is=>$($env:SAUCE_USERNAME)"; | |
Write-Host "Sauce Access Key stored in Env variables is=>$($env:SAUCE_ACCESS_KEY)"; | |
Write-Host "Sauce Build Repository URI stored in Env variables is=>$($env:BUILD_REPOSITORY_URI)"; | |
#checking to make sure that env variables were set between yml tasks | |
- powershell: | | |
Write-Host "Sauce Username stored in Env Variables variables is=>$($env:SAUCE_USERNAME)"; | |
Write-Host "Sauce Access Key stored in ADO variables is=>$($env:SAUCE_ACCESS_KEY)"; | |
displayName: display env variables bw posh tasks | |
- task: VSTest@2 | |
displayName: 'Run Best Practices Framework' | |
inputs: | |
searchFolder: '$(System.DefaultWorkingDirectory)' | |
testSelector: 'testAssemblies' | |
testAssemblyVer2: | | |
**\*Selenium*.dll | |
!**\SauceExamples\packages\*.dll | |
!**\packages\*.dll | |
testFiltercriteria: 'TestCategory=BestPractices' | |
runInParallel: true | |
codeCoverageEnabled: true | |
testRunTitle: 'NUnit Automation Framework' | |
rerunFailedTests: true | |
rerunFailedThreshold: 10 | |
rerunMaxAttempts: 2 | |
failOnMinTestsNotRun: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment