Azure-pipelines-tasks: Publishing test results with failed tests does not fail the 2015 TFS build

Created on 17 May 2017  路  4Comments  路  Source: microsoft/azure-pipelines-tasks

Hello,

i am using angular cli and for unit test i use Karma. So for CI TFS build, i am using npm task for karma unit test . We use the "publish test results" task to publish the results to the build. The results get published correctly and we can see that some tests failed. When tests fail, however, the build is not marked as failed. I could fail the build when running npm test task, but the results would not get published. Is there a way for the build to look at the published test results and fail if there are test failures?

Thanks

Test

Most helpful comment

Just wanted to add that the suggested workaround can still give issues. If you use a CI setup which you don't force clean checkouts upon for the sake of build time, your build might get started while having an old report in its folders. If you don't clean out these reports actively before the first failing build step, you end up publishing the report from that previous build.

All 4 comments

Your test runner needs to fail the build if there are failures. You can set the control options on the publish results task to alwasy run or run even when previous tasks have failed

I need to fail the build based on test results from "Publish Test Results" task, otherwise i don't see the test results in "Test" tab or in summary. Its says "No tests runs available for this build"

@Yaash19 there is an option in the "Publish Test Results" task so it runs even if previous tasks failed the build. This is called "Always Run" in the version I am using.

Alternatively, I tick the test run task option to "continue on error".

Just wanted to add that the suggested workaround can still give issues. If you use a CI setup which you don't force clean checkouts upon for the sake of build time, your build might get started while having an old report in its folders. If you don't clean out these reports actively before the first failing build step, you end up publishing the report from that previous build.

Was this page helpful?
0 / 5 - 0 ratings