Handling global failure in CI

When integrating Hiptest with a CI tool, it may happen that the test run is not fully synchronized with the status of the last build. This mainly happens when the tests have not been ran (for example due to an installation or compilation error during the setup process).
In such case, as there is no test results to push at the end of the build, Hiptest consider only the status from the previous build. So it might still show green statuses even if the last build failed.

There is a simple way to fix this kind of issues.

When pushing results with Hiptest publisher

If you use hiptest-publisher to generate the test scripts and push the results, you can simply add the following line in you config file:

global_failure_on_missing_reports = true

This will ensure that, when no results file have been generated, Hiptest will be notified that there were a global failure and the tests will all be marked as failed.
Note that you should only add the line once the full process has been shown as reliable (so once you have a few successful builds that pushed results back to Hiptest).

When pushing results with cUrl

If you want to push results for tests that were not written in Hiptest, you can use another cUrl command to notify a global failure of the build.

Below is an example of a post-failure action written with bash:


#!/bin/bash

FILE=<path to you result file>
SECRET_TOKEN=<your hiptest secret token>
TEST_RUN_ID=<the test run to which you want to push results>

if [ -f $FILE ]; then
  curl -X POST -F file=@$FILE https://hiptest.net/import_test_reports/$SECRET_TOKEN/$TEST_RUN_ID/junit
else
 curl -X POST https://hiptest.net/report_global_failure/$SECRET_TOKEN/$TEST_RUN_ID/
fi

This script ensures that, if the result file is present, it will be pushed to Hiptest to update the results in the test run and otherwise, declare a global failure.

Download the ebook

This field is required

This field is required

Please enter a valid email address

Thank you, the ebook has been sent to your mailbox

Hiptest is FREE for open source projects

We actually utilize a number of open source components, which is why Hiptest service is free for any open source project. We are giving back to the community!

Your open source project must meet the following criteria to be approved:

  • Your project is licensed under a license approved by the Open Source Initiative
  • Your project source code is available for download
  • Your project has a publicly accessible website

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close