-
Notifications
You must be signed in to change notification settings - Fork 381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add feature tests via Behat #6070
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #6070 +/- ##
=============================================
- Coverage 75.03% 71.20% -3.84%
+ Complexity 5829 5827 -2
=============================================
Files 232 233 +1
Lines 17618 18566 +948
=============================================
Hits 13219 13219
- Misses 4399 5347 +948
Flags with carried forward coverage won't be shown. Click here to find out more.
|
74f78a6
to
a627be8
Compare
2ed0dc1
to
e443e19
Compare
0c2f266
to
1bf0518
Compare
Plugin builds for 07a844f are ready 🛎️!
|
I tried running
|
I guess that's because my environment variables are empty. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests are working in CI context, so that's the most important thing.
Summary
This PR adds feature testing via Behat to the plugin. It reuses the testing infrastructure and Behat definitions from WP-CLI (see https://github.com/wp-cli/wp-cli-tests).
Before the tests are run for the first time, the following command has to be executed:
This should create the needed table(s) in the database for the tests to be run within.
Database credentials can be provided via environment variables if the database is not found on
localhost:3306
:WP_CLI_TEST_DBHOST
is the host to use and can include a port, i.e127.0.0.1:33060
(defaults tolocalhost
)WP_CLI_TEST_DBROOTUSER
is the user that has permission to administer databases and users (defaults toroot
).WP_CLI_TEST_DBROOTPASS
is the password to use for the above user (defaults to an empty password).WP_CLI_TEST_DBUSER
is the user that the tests run under (defaults towp_cli_test
).WP_CLI_TEST_DBPASS
is the password to use for the above user (defaults topassword1
).Then, to run the tests, the following command can be used:
Note: The code coverage is currently not being executed on GHA because there is still an issue with the interpretation of the code coverage data within codecov (probably a path discrepancy). This should be fixed and re-enabled in a separate PR.
Fixes #3076
Checklist