Can anybody provide the information as how we can integrate Angular test cases (Jasmine/Karma) into Azure Pipelines.Where are the test cases result displayed after the build pipeline is executed succesfully
Can anybody provide the information as how we can integrate Angular test cases (Jasmine/Karma) into Azure Pipelines.Where are the test cases result displayed after the build pipeline is executed succesfully
Check case Running Jasmine tests on Azure DevOps as part of automated build process
You can do this through the following script and tasks:
ng test PublishTestResults taskPublishCodeCoverageResults task In the Azure Pipelines YAML file, this could look as follows:
# perform unit-tets and publish test and code coverage results
- script: |
npx ng test --watch=false --karmaConfig karma.conf.ci.js --code-coverage
displayName: 'perform unit tests'
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: '**/TESTS-*.xml'
displayName: 'publish unit test results'
- task: PublishCodeCoverageResults@1
displayName: 'publish code coverage report'
condition: succeededOrFailed()
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(Build.SourcesDirectory)/coverage/cobertura-coverage.xml'
failIfCoverageEmpty: true