Skip to content

List skipped and incomplete tests with their reasons in the test output - #361

Open
softglazee wants to merge 2 commits into
WordPress:masterfrom
softglazee:47-list-skipped-tests
Open

softglazee wants to merge 2 commits into
WordPress:masterfrom
softglazee:47-list-skipped-tests

Conversation

@softglazee

Copy link
Copy Markdown

PHPUnit lists the failed and risky tests at the end of a run, but it shows skipped and incomplete tests only as a count (Skipped: 62) unless it runs with --verbose. junit.xml does not have the reasons either: PHPUnit 9.6 writes a skipped or incomplete test as an empty <skipped/> element. So a host could not see anywhere which tests were skipped or why. This PR runs PHPUnit with --verbose, the same flag WordPress core's own PHPUnit workflow uses, and describes the lists in the README.

Fixes #47.

Changes

  • test.php: add --verbose to the default PHPUnit command. A custom WPT_PHPUNIT_CMD is not changed.
  • README: add the R (risky) symbol, and a short paragraph about the lists at the end of the run, with an example from a real run.

The report sent to WordPress.org does not change. I checked the receiving plugin (phpunit-test-reporter/src/class-restapi.php in the WordPress/wordpress.org repository). When a result has failures, it treats every test case under testsuites as a failure in the "new failures" email, so skipped tests should not go into the payload.

Risky tests: PHPUnit already lists them without --verbose. They are not in junit.xml, because --dont-report-useless-tests also turns off risky reporting in the PHPUnit 9.6 JUnit logger (JUnit::addRiskyTest() returns early when reportRiskyTests is false).

Testing Instructions

Environment

  • WordPress: trunk, r64693
  • PHP: 8.4.27
  • Server: Docker image built from this repository's docker/Dockerfile with PHP_VERSION=8.4, run as the non-root wptests user
  • Database: MariaDB 11.8.9
  • Browser: n/a (command line test)
  • OS: Linux (Docker Desktop, WSL2 kernel 6.18.33)
  • Theme: the test suite's default theme
  • MU Plugins: None
  • Plugins: None
  • PHPUnit 9.6.38, Node.js 24.22.1, npm 11.19.1, ImageMagick 7.1.1-43, imagick 3.8.1

Steps to Test

  1. cp .env.default .env, set the WPT_DB_* values, set WPT_TEST_DIR to the same value as WPT_PREPARE_DIR, then source .env.
  2. php prepare.php
  3. php test.php
  4. php report.php without WPT_REPORT_API_KEY, so it prints the results instead of uploading them.
  5. php cleanup.php
  6. To compare, run step 3 on master as well, against the same prepared checkout, before step 5.

Expected Results

  • ✅ The PHPUnit command that test.php logs ends with --dont-report-useless-tests --verbose.
  • ✅ After the warnings, the output lists every skipped test with its reason: There were 62 skipped tests:.
  • ✅ junit.xml is the same as on master: the same totals and the same status for every test case.
  • ✅ The results that report.php prints (the results field of the upload) are the same as on master, apart from time.

Results

Before (master at 1f276b2), the end of the test.php output:

WARNINGS!
Tests: 30867, Assertions: 4573915, Warnings: 86, Skipped: 62.

After (this branch), the same run adds the list. Three of the 62 entries:

There were 62 skipped tests:
...
3) Tests_DB::test_locale_floats
No European locales available for testing.

/tmp/wp-test-runner/tests/phpunit/tests/db.php:89
...
13) Test_Image_Resize_GD::test_resize_heic
No HEIC support in the editor engine WP_Image_Editor_GD on this system.

/tmp/wp-test-runner/tests/phpunit/tests/image/resize.php:129
...
56) Tests_Sitemaps_wpSitemapsRenderer::test_get_sitemap_index_xml
This test requires the XSL extension.
...
WARNINGS!
Tests: 30867, Assertions: 4573915, Warnings: 86, Skipped: 62.

The XSL entry is how I found that the image built from docker/Dockerfile does not have the xsl extension, so 6 sitemap tests are skipped in the container runs. That is a separate change.

junit.xml from both runs: tests=30867 assertions=4573915 failures=0 errors=0 warnings=86 skipped=62, and the sorted list of test cases with their status is identical (same SHA-1 over 30867 lines).

report.php results from both runs, apart from time: {"tests":"30867","failures":"0","errors":"0","testsuites":[]}.

php -l test.php and vendor/bin/phpcs test.php with the repository ruleset are clean.

Not tested: the multisite flavor and an SSH setup. In both cases the flag is part of the same command string.

My connection to GitHub is slow, so prepare.php cloned wordpress-develop trunk from a local mirror (a git insteadOf rule), and the Gutenberg build was downloaded once beforehand. No runner file was changed for that.

Notes

Use of AI

AI assistance: Yes
Tool(s): Claude Code
Used for: Investigation, implementation, the end-to-end test runs and PR wording. I reviewed the reasoning and the test results, and I take responsibility for the contribution.

PHPUnit lists failed and risky tests at the end of a run, but it shows
skipped and incomplete tests only as a count unless it runs with
--verbose. junit.xml marks those tests without a reason, so a host could
not see anywhere why a test did not run. Run PHPUnit with --verbose, as
WordPress core's own PHPUnit workflow does, and describe the lists in the
README. The report sent to WordPress.org does not change.

Fixes WordPress#47.
@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: softglazee <softglaze@git.wordpress.org>
Co-authored-by: ekamran <ekamran@git.wordpress.org>
Co-authored-by: danielbachhuber <danielbachhuber@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

✅ Container Tests: success

Results for 94c9ac9 from workflow run #11. Logs, junit.xml, and env.json are attached to the run as artifacts.

PHPUnit Test Runner: ✅ passed

  • PHP: 8.1.34
  • Database: mariadb:10.6
Step Status Exit code Duration
prepare ✅ passed 0 48s
test ✅ passed 0 430s
report ✅ passed 0 0s
cleanup ✅ passed 0 15s

Test results

Tests Failures Errors Skipped Time
30867 0 0 68 319s

PHPUnit Test Runner: ✅ passed

  • PHP: 8.3.36
  • Database: mysql:8.4
Step Status Exit code Duration
prepare ✅ passed 0 43s
test ✅ passed 0 373s
report ✅ passed 0 0s
cleanup ✅ passed 0 14s

Test results

Tests Failures Errors Skipped Time
30867 0 0 63 266s

@ekamran ekamran left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this one.

I checked the claims against PHPUnit 9.6.38: DefaultResultPrinter::printResult() prints the incomplete and skipped lists only when verbose, the JUnit logger writes an empty <skipped/>, and it leaves risky tests out when useless tests are not reported. Core trunk still requires yoast/phpunit-polyfills ^1.1.0, so PHPUnit stays on 9.x, where --verbose is a valid option, and core's own workflow passes it. In the container test artifacts for a3aa891, both jobs ran with --verbose and printed the list, and report.php reads only junit.xml, so the upload does not change.

One suggestion on the README below, for hosts with a custom WPT_PHPUNIT_CMD. Happy to approve after that.

A side effect, not a blocker: when tests fail, docker/summarize.php adds the last 40 lines of test.log, which may now include skipped-list entries, since PHPUnit prints that list after the failures. The failed tests table it builds from junit.xml still lists the failures (the first 50) with their messages.

Comment thread README.md Outdated

@ekamran ekamran left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, 94c9ac9 changes only that README line, matching the suggestion. Approving.

On the summarize.php tail: no follow-up needed from my side, the failed tests table from junit.xml already covers it.

@softglazee

Copy link
Copy Markdown
Author

@ekamran Can you help me to mention here other reviewer too for reveiwing it too and then merge?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide a human-readable summary of skipped and risky tests

2 participants