IMB
IMB

Reputation: 15889

How does Gitlab CI determine if a PHPUnit test pass or fails?

I have this basic .gitlab-ci.yml file.

image: php:7.2

before_script:
  # install git
  - apt-get update -yqq
  - apt-get install git -yqq
  # Install composer
  - curl -sS https://getcomposer.org/installer | php
  # Install all project dependencies
  - php composer.phar install


tests:
  script:
    - vendor/bin/phpunit tests

This works just fine, it alerts me if unit tests fail or pass.

My question is how exactly does Gitlab CI know this? Do they parse the output of PHPUnit and see if the string FAILURES! exist?

Upvotes: 5

Views: 2468

Answers (1)

Azaradel
Azaradel

Reputation: 301

The gitlab-ci only checks the exit codes of processes running inside it. If a process exits with another status code than 0 then the pipeline stops and declares failure. That's how the CI pipelines works overall, not only gitlab but Jenkins, etc. too.

Upvotes: 9

Related Questions