You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 3c49054
Browse filesBrowse the repository at this point in the historyBrowse files
Set `WP_CLI_TEST_PARALLEL` to a number of workers to spread the scenarios over that many Behat processes:
271
+
```bash
272
+
WP_CLI_TEST_PARALLEL=4 composer behat
273
+
```
274
+
275
+
Every worker but the first gets its own temporary directory, and with it its own home directory, caches and run directories, as well as its own test database, named after the test database with a numeric suffix (`wp_cli_test_1`, `wp_cli_test_2`, ...). Run `composer prepare-tests` once to allow the test user to create these databases. Without that permission, the scenarios are run one after the other, as they are on Windows, when collecting code coverage, or when selecting scenarios by path or name.
276
+
277
+
Scenarios that rely on resources shared across the system, such as a fixed port or a fixed path in the system's temporary directory, are all run by the first worker, one after the other. `composer behat-rerun` re-runs exactly the scenarios that failed in the last parallel run.
278
+
279
+
Set `WP_CLI_TEST_DOCKER` to run the scenarios in throwaway Docker containers instead, every worker in its own:
| not set (default), `0`, `no`, `off`| The scenarios run without Docker. |
287
+
|`auto`| The scenarios run in containers where possible, and without Docker otherwise, which is reported. |
288
+
|`1`, `yes`, `on`| The scenarios run in containers, and the run fails where that is not possible. |
289
+
290
+
Docker is not used on Windows, when collecting code coverage, when Docker is not available, when the image cannot be built or when the database server cannot be identified.
291
+
292
+
Each worker gets its own network, temporary directory and database server, of the same type and version as the one configured through the `WP_CLI_TEST_DB*` variables (or set the image through `WP_CLI_TEST_DOCKER_DB`, e.g. `mysql:8.0`, so that the host needs neither a database server nor a client). Nothing is shared between workers, so they can run any scenario. The database servers keep their data in memory. Scenarios selected by path or name run in a single container.
293
+
294
+
The containers run the same PHP version as the host, unless `WP_CLI_TEST_DOCKER_PHP` sets another one:
The project's Composer dependencies are then installed for that PHP version in a separate directory, the way CI installs them without a lock file, and refreshed once a day. Dependencies that are linked to local checkouts, as in `wp-cli/wp-cli-dev`, come from their published versions in that case, which is reported.
300
+
268
301
### Linting the feature files
269
302
270
303
`composer lint-gherkin` checks `features/` with
@@ -362,6 +395,17 @@ they test.
362
395
container and is only reachable over TCP. Set `WP_CLI_TEST_DBSOCKET` to point at the
363
396
socket if it lives somewhere unusual.
364
397
398
+
Before the scenarios run, the scenarios that are left out are listed together with the reason,
399
+
separating the ones the environment cannot run, such as those needing a PHP extension that is
400
+
not loaded, from the ones that are not part of the configuration being tested, such as those
401
+
for another database or WordPress version. On GitHub Actions, the list is also added to the
402
+
job summary.
403
+
404
+
Set `WP_CLI_TEST_STRICT_REQUIREMENTS` where the environment is expected to provide everything
405
+
the scenarios need, such as on CI. The run then stops before any scenario starts when some of
406
+
them cannot run in the environment, or when the database cannot be reached, instead of leaving
407
+
those scenarios out or falling back to SQLite.
408
+
365
409
#### WP-CLI Binary
366
410
367
411
You can run the tests against a specific WP-CLI binary, instead of using the one that has been built in your project's `vendor/bin` folder.
0 commit comments