I am planning to run end to end tests overnight using VSTS. Is there any guiding document or sample plans to show how to implement this.
Basically we have API projects in VSTS where we have End to End test projects within the main solution. So we wanted to run those tests overnight. All the other tests run as part of the build but NOT E2E as it should run after the deployment.
This is the build.yaml
resources:
- repo: self
queue:
name: Hosted VS2017
demands:
- vstest
- msbuild
- visualstudio
variables:
BuildPlatform: 'any cpu'
BuildConfiguration: 'release'
steps:
- task: NuGetToolInstaller@0
displayName: 'Use NuGet 4.4.1'
inputs:
versionSpec: 4.4.1
- task: NuGetCommand@2
displayName: 'NuGet restore'
- task: VSBuild@1
displayName: 'Build solution'
inputs:
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(Build.ArtifactStagingDirectory)\app.zip" /p:DeployIisAppPath="Default Web Site"'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
- task: powershell@2
inputs:
targetType: filePath
filePath: deploy/lib/GetSwaggerByExe.ps1
arguments: '-RootDirectory "src/SwaggerGenerator" -OutputFile "deploy/swagger/swagger.json" '
displayName: 'Create Swagger file'
- task: VSTest@2
displayName: 'Test Assemblies'
inputs:
testAssemblyVer2: |
**\$(BuildConfiguration)\*test*.dll
!**\obj\**
!**\*\*.EndToEnd.Integration.Tests*.dll
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
- task: PublishTestResults@2
displayName: 'Publish API Test Results'
inputs:
testResultsFormat: VSTest
testResultsFiles: '**/*.trx'
- task: PublishSymbols@2
displayName: 'Publish symbols path'
inputs:
PublishSymbols: false
continueOnError: true
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)/app.zip'
ArtifactName: app
- task: PublishBuildArtifacts@1
displayName: 'Publish deploy scripts'
inputs:
PathtoPublish: deploy
ArtifactName: deploy
I have below task in CD
Is this because of the incorrect path in test files parameter in the above task step. If so how to find out the correct path? I have referred below links as well, no luck though.
Build logs
Project "D:\a\1\s\src\XXXXSearch.Api.sln" (1) is building "D:\a\1\s\src\XXXSearch.EndToEnd.Integration.Tests\XXXSearch.EndToEnd.Integration.Tests.csproj" (6) on node 1 (default targets).
2018-12-23T09:48:50.2267347Z PrepareForBuild:
2018-12-23T09:48:50.2267390Z Creating directory "bin\Release\".
2018-12-23T09:48:50.2269510Z Creating directory "obj\Release\".
Creating "D:\a\1\s\src\XXXXSearch.EndToEnd.Integration.Tests\obj\Release\XXXSearch.EndToEnd.Integration.Tests.csproj.CopyComplete" because "AlwaysCreate" was specified.
2018-12-23T09:48:50.4678280Z _CopyAppConfigFile:
2018-12-23T09:48:50.4678368Z Copying file from "app.config" to "bin\Release\XXXSearch.EndToEnd.Integration.Tests.dll.config".
2018-12-23T09:48:50.4686244Z CopyFilesToOutputDirectory:
2018-12-23T09:48:50.4686316Z Copying file from "obj\Release\XXXSearch.EndToEnd.Integration.Tests.dll" to "bin\Release\XXXSearch.EndToEnd.Integration.Tests.dll".
2018-12-23T09:48:50.4691372Z XXXSearch.EndToEnd.Integration.Tests -> D:\a\1\s\src\XXXSearch.EndToEnd.Integration.Tests\bin\Release\XXXSearch.EndToEnd.Integration.Tests.dll
2018-12-23T09:48:50.4693481Z Copying file from "obj\Release\XXXSearch.EndToEnd.Integration.Tests.pdb" to "bin\Release\XXXSearch.EndToEnd.Integration.Tests.pdb".
2018-12-23T09:48:50.4755662Z Done Building Project "D:\a\1\s\src\XXXSearch.EndToEnd.Integration.Tests\XXXSearch.EndToEnd.Integration.Tests.csproj" (default targets)
Added below tasks in build.yaml file
- task: CopyFiles@2
inputs:
contents: D:/a/1/s/src/XXX.SiteSearch.EndToEnd.Integration.Tests/bin/Release/XXX.SiteSearch.EndToEnd.Integration.Tests.dll
targetFolder: $(Build.ArtifactStagingDirectory)
- task: PublishBuildArtifacts@1
displayName: 'Publish E2E Artifact'
inputs:
PathtoPublish: 'D:/a/1/a/src/XXX.SiteSearch.EndToEnd.Integration.Tests/bin/Release/XXX.SiteSearch.EndToEnd.Integration.Tests.dll'
ArtifactName: e2e
