I have the following azure-pipeline to run two docker compose tasks for 2 unit test projects.
- 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'
This works fine, and combines the test and code coverage results. But I have to define each unit test project in the pipeline in a separate task.
Is there a way to run the tests for all projects in a single azure-pipeline task?
Both projects are in the same solution (.NET Core). I understand I could have the tests in a single project, but wanted to keep a separation of concerns.