Search by

wp-cli / automated-tests

schlessera

Automated tests across WP-CLI and all bundled packages.

Package info

github.com/wp-cli/automated-tests

Homepage

Documentation

Language:Shell

pkg:composer/wp-cli/automated-tests

Statistics

Installs: 3

Dependents: 0

Suggesters: 0

Stars: 6

Open Issues: 0

v2.0.2 2024-07-18 08:37 UTC

This package is auto-updated.

Last update: 2026-11-27 11:52:51 UTC


README

This repository runs automated tests for the nightly Phar builds of WP-CLI.

Testing

Usage Instructions

The testing is set up through the use of environment variables in the Travis CI matrix configuration.

Testing source packages

$TEST_PACKAGE enables tests against source packages. You can select which commands/packages to test.

The following options can be set:

  • none - No packages are tested.
  • all - The framework as well as all bundled commands are tested.
  • commands - Only the command packages are tested.
  • <package name> - Only the package named is tested.

Testing against Phar distributions

$TEST_PHAR enables tests against the Phar distributions. You can select which distribution to test. The selected distribution will be tested against all bundled commands/packages.

The following options can be set:

  • none - Skip phar testing.
  • nightly - Use the nightly phar.
  • stable - Use the latest stable phar release.
  • all - Use both the latest stable release phar as well as the nightly phar.

JUnit reports

$WP_CLI_TEST_JUNIT_DIR writes JUnit reports to the given directory, in addition to the progress output that is always printed. This is useful to compare the results of two runs, as the reports name every scenario along with the file and line it is defined on, which the progress output does not.

WP_CLI_TEST_JUNIT_DIR=build/junit TEST_PACKAGE=wp-cli/entity-command composer test

Behat names each report after the suite it belongs to, so one package results in one report:

build/junit/wp_cli_entity_command.xml
build/junit/rerun/wp_cli_entity_command.xml

Failed scenarios are run a second time. Reports of that rerun are written to the rerun subdirectory, as they only cover the scenarios that failed the first time and would otherwise overwrite the full report of the package.

The rerun report holds a result for every scenario it ran, which is what tells a flaky scenario from a failing one:

  • A scenario reported as failed in the report of the package and as passed in the rerun report failed once and then passed, and was therefore flaky.
  • A scenario reported as failed in both is failing consistently.

Parallel workers would each overwrite the report of the package with their own share of its scenarios, so $WP_CLI_TEST_PARALLEL is ignored while JUnit reports are written and the scenarios run one after the other.

Reports left behind by an earlier run are removed before the tests start, so that the directory only ever describes the run that wrote it. A package that passes produces no rerun report at all, which would otherwise leave a stale one in place.

Automated Builds

This repository is being rebuilt through a Travis CI cron job every 24 hours to post test results in Emails and Slack.