PHP
Test Suite Monitoring for PHPUnit
Monitor your PHPUnit test suite health with TestGlance
Get Started in 3 Steps
- 1Add JUnit logging to your phpunit.xml: `<logging><junit outputFile="test-results/phpunit.xml"/></logging>`
- 2No extra packages needed — JUnit XML logging is built into PHPUnit
- 3Add the TestGlance GitHub Action to your CI workflow
Reporter Configuration
<!-- phpunit.xml -->
<phpunit>
<!-- ... your existing config ... -->
<logging>
<junit outputFile="test-results/phpunit.xml"/>
</logging>
</phpunit>GitHub Actions Workflow
# .github/workflows/test.yml
name: Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: "8.3"
- run: composer install
- name: Run tests
run: vendor/bin/phpunit --log-junit test-results/phpunit.xml
- name: Report to TestGlance
if: always()
uses: testglance/action@v1
with:
api-key: ${{ secrets.TESTGLANCE_API_KEY }}
report-path: test-results/phpunit.xmlWhat You Get
- ✓Flaky test detection — automatically identify tests that pass and fail intermittently
- ✓Duration trends — track which tests are getting slower over time
- ✓Health score — a single metric summarizing your test suite reliability
- ✓CI summary — rich test result summaries directly in your GitHub Actions runs
FAQ
How do I generate JUnit XML from PHPUnit?
Use the `--log-junit` flag: `phpunit --log-junit test-results/phpunit.xml`, or add `<logging><junit outputFile="test-results/phpunit.xml"/></logging>` to your phpunit.xml config.
Does TestGlance work with PHPUnit data providers?
Yes. Each data provider iteration appears as a separate test case in the JUnit XML output, so TestGlance tracks them individually.
Can I monitor PHPUnit code coverage alongside tests?
TestGlance focuses on test pass/fail status and durations. Code coverage reports require separate tooling, but your test health and flaky detection work out of the box.
Start Monitoring Your PHPUnit Tests
Free to get started. Set up in under 5 minutes.
Get Started