Skip to content

Commit 03d7be7

Browse files
committed
behat: Use dmarynicz/behat-parallel-extension to run tests in parallel when BEHAT_PARALLEL is set
1 parent e821347 commit 03d7be7

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

behat.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ default:
55
- WP_CLI\Tests\Context\FeatureContext
66
paths:
77
- features
8+
extensions:
9+
DMarynicz\BehatParallelExtension\Extension: ~

bin/run-behat-tests

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ if [[ "$@" == *"--help"* ]]; then
1919
exit $ret
2020
fi
2121

22+
PARALLEL=""
23+
if [[ -n "${BEHAT_PARALLEL}" ]]; then
24+
PARALLEL="--parallel"
25+
fi
26+
27+
2228
# Turn WP_VERSION into an actual number to make sure our tags work correctly.
2329
if [ "${WP_VERSION-latest}" = "latest" ]; then
2430
export WP_VERSION=$(curl -s https://api.wordpress.org/core/version-check/1.7/ | jq -r ".offers[0].current")
@@ -45,4 +51,4 @@ export WP_CLI_TESTS_ROOT
4551
BEHAT_TAGS=$(php "$WP_CLI_TESTS_ROOT"/utils/behat-tags.php)
4652

4753
# Run the functional tests.
48-
vendor/bin/behat --format progress "$BEHAT_TAGS" --strict "$@"
54+
vendor/bin/behat "${PARALLEL}" --format progress "$BEHAT_TAGS" --strict "$@"

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"php": ">=5.6",
1313
"behat/behat": "^3.7",
1414
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.3 || ^0.5 || ^0.6.2 || ^0.7.1 || ^1.0.0",
15+
"dmarynicz/behat-parallel-extension": "^1.0",
1516
"php-parallel-lint/php-console-highlighter": "^1.0",
1617
"php-parallel-lint/php-parallel-lint": "^1.3.1",
1718
"phpcompatibility/php-compatibility": "dev-develop",

0 commit comments

Comments
 (0)