我具有以下的蔚蓝管道,可为2个单元测试项目运行两个docker compose任务。
- task: DockerCompose@0
displayName: 'Run Application Unit Tests'
inputs:
containerregistrytype: 'Azure Container Registry'
azureSubscription: $(azureSubscription)
azureContainerRegistry: $(azureContainerRegistry)
dockerComposeFile: '**/docker-compose.yml'
action: 'Run a specific service'
serviceName: 'application.tests'
detached: false
- task: DockerCompose@0
displayName: 'Run Infrastructure Unit Tests'
inputs:
containerregistrytype: 'Azure Container Registry'
azureSubscription: $(azureSubscription)
azureContainerRegistry: $(azureContainerRegistry)
dockerComposeFile: '**/docker-compose.yml'
action: 'Run a specific service'
serviceName: 'infrastructure.tests'
detached: false
- task: PublishTestResults@2
displayName: 'Publish test results'
inputs:
testResultsFormat: 'VSTest'
testResultsFiles: '/opt/vsts/work/_temp/*.trx'
mergeTestResults: true
failTaskOnFailedTests: true
- task: PublishCodeCoverageResults@1
displayName: 'Publish coverage report'
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '/opt/vsts/work/_temp/*.cobertura.xml'
这可以正常工作,并将测试和代码覆盖率结果组合在一起。但是我必须在单独的任务中定义管道中的每个单元测试项目。
是否有一种方法可以在一个天蓝色管道任务中为所有项目运行测试?
两个项目都在同一解决方案(.NET Core)中。我知道我可以在一个项目中进行测试,但想将关注点分开。