2

We are using PHPUnit and we are running a bunch of integration tests which tests our 3rd party APIs, and we want them to show a warning when they fails in Codeship but don't block the build because we really have no control over them. Is this even possible? What we are curently doing is to mark all failed integration tests as incomplete through

trait IntegrationTestTrait
{
    protected function onNotSuccessfulTest(Exception $e)
    {
        $this->markTestIncomplete("This test failed for the following       reason " . $e->getMessage());
    }
}

But this doesn't really work because nobody really cares about incompleted tests. Does anyone know if there is anything stronger than incomplete but won't fail the whole build that we can use?

Tom Lei
  • 199
  • 1
  • 3
  • Codeship will mark a step as failed if the exit code of the command you run is not zero. So, as long as the program exits with a zero exit code, you can have any output you want. I would not recommend this for running your tests, but you can also force successful step by using `test_command || true`. You could use this on a separate step that only tests external APIs for example. – mlocher Jan 25 '17 at 07:17

1 Answers1

2

Does anyone know if there is anything stronger than incomplete but won't fail the whole build that we can use?

You could echo out a warning with a red background to catch your attention, if you are watching the PHPUnit testing, but want it to keep going.

In the unit test:

echo "\e[41;97m" . "Warning Text" . "\e[0m\n";

These are command line escape sequences that turn on colors. The 41;97 is a background of red and 0m clears it. enter image description here

Katie
  • 2,594
  • 3
  • 23
  • 31