Skip to main content


In the steps below, we'll start with a PHP project that has an existing PHPUnit test suite, and we'll add JUnit XML as an additional output format for the test suite.

  1. Update your CI workflow to output a JUnit XML file describing the test results. Below we add the --log-junit option when running phpunit, and we tell it to write the report to a file named junit.xml at the root of the project.

    run: composer install --prefer-dist --no-progress

    - name: Run test suite
    run: vendor/bin/phpunit ./tests --log-junit junit.xml

    This example project uses Github Actions for CI, so we're updating our CI script in the .github/workflows/ directory. If you're using a different CI service, apply this change wherever your CI script is defined (e.g., .circleci/config.yml for CircleCI, etc.).

  2. Commit this change to your repository.

    git commit -am "Update CI to generate JUnit XML for test results"

    The final result of these changes should resemble commit 918d1a0 in the buildpulse-example-phpunit repository.