Add instructions for testing contributions in the CONTRIBUTING.md file. (#40018)
Checks ran after closing and opening the PR. One failed but it passed after re-run. Checked and appeard the old anchors were not used in other places so merging this one - thanks!
This commit is contained in:
commit
33e01b9af2
|
@ -37,6 +37,10 @@ Please take a moment to review the [project readme](https://github.com/woocommer
|
|||
- Run our build process described in the document on [how to set up WooCommerce development environment](https://github.com/woocommerce/woocommerce/wiki/How-to-set-up-WooCommerce-development-environment), it will install our pre-commit hook, code sniffs, dependencies, and more.
|
||||
- Before pushing commits to GitHub, check your code against our code standards. For PHP code in the WooCommerce Core project you can do this by running `pnpm --filter=woocommerce run lint:php:changes:branch`.
|
||||
- Whenever possible, please fix pre-existing code standards errors in code that you change.
|
||||
- Please consider adding appropriate tests related to your change if applicable such as unit, API and E2E tests. You can check the following guides for this purpose:
|
||||
- [Writing unit tests](https://github.com/woocommerce/woocommerce/blob/trunk/plugins/woocommerce/tests/README.md#guide-for-writing-unit-tests).
|
||||
- [Writing API tests](https://github.com/woocommerce/woocommerce/tree/trunk/plugins/woocommerce/tests/api-core-tests#guide-for-writing-api-tests).
|
||||
- [Writing E2E tests](https://github.com/woocommerce/woocommerce/tree/trunk/plugins/woocommerce/tests/e2e-pw#guide-for-writing-e2e-tests).
|
||||
- Ensure you use LF line endings in your code editor. Use [EditorConfig](http://editorconfig.org/) if your editor supports it so that indentation, line endings and other settings are auto configured.
|
||||
- When committing, reference your issue number (#1234) and include a note about the fix.
|
||||
- Ensure that your code supports the minimum supported versions of PHP and WordPress; this is shown at the top of the `readme.txt` file.
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
Significance: patch
|
||||
Type: dev
|
||||
Comment: Update CONTRIBUTING.md file to include instructions on how adding unit, API and E2E tests when applicable.
|
||||
|
||||
|
|
@ -9,10 +9,10 @@ This document discusses unit tests. See [the e2e README](https://github.com/wooc
|
|||
- [Initial Setup](#initial-setup)
|
||||
- [MySQL database](#mysql-database)
|
||||
- [Setup instructions](#setup-instructions)
|
||||
- [Running Tests](#running-tests)
|
||||
- [Running Unit Tests](#running-unit-tests)
|
||||
- [Troubleshooting](#troubleshooting)
|
||||
- [Running tests in PHP 8](#running-tests-in-php-8)
|
||||
- [Writing Tests](#writing-tests)
|
||||
- [Guide for Writing Unit Tests](#guide-for-writing-unit-tests)
|
||||
- [Automated Tests](#automated-tests)
|
||||
- [Code Coverage](#code-coverage)
|
||||
|
||||
|
@ -51,7 +51,7 @@ Example:
|
|||
|
||||
**Important**: The `<db-name>` database will be created if it doesn't exist and all data will be removed during testing.
|
||||
|
||||
## Running Tests
|
||||
## Running Unit Tests
|
||||
|
||||
Change to the plugin root directory and type:
|
||||
|
||||
|
@ -97,7 +97,7 @@ $ tests/bin/install.sh woocommerce_tests_1 root root
|
|||
|
||||
Note that `woocommerce_tests` changed to `woocommerce_tests_1` as the `woocommerce_tests` database already exists due to the prior command.
|
||||
|
||||
## Writing Tests
|
||||
## Guide for Writing Unit Tests
|
||||
|
||||
There are three different unit test directories:
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ This package contains automated API tests for WooCommerce, based on Playwright a
|
|||
- [Introduction](#introduction)
|
||||
- [About the Environment](#about-the-environment)
|
||||
- [Test Variables](#test-variables)
|
||||
- [Guide for writing tests](#guide-for-writing-tests)
|
||||
- [Guide for writing API tests](#guide-for-writing-api-tests)
|
||||
- [What aspects of the API should we test?](#what-aspects-of-the-api-should-we-test)
|
||||
- [Creating test structure](#creating-test-structure)
|
||||
- [Test Data Setup/Teardown](#test-data-setupteardown)
|
||||
|
@ -130,7 +130,7 @@ After you run a test, it's best to restart the environment to start from a fresh
|
|||
- `pnpm env:destroy` when you make changes to `.wp-env.json`
|
||||
- `pnpm env:test` to spin up the test environment
|
||||
|
||||
## Guide for writing tests
|
||||
## Guide for writing API tests
|
||||
|
||||
When writing new tests, a good source on how to get started is to reference the [existing tests](https://github.com/woocommerce/woocommerce/tree/trunk/plugins/woocommerce/tests/api-core-tests/tests). Data that is required for the tests should be located in an equivalent file in the [data](https://github.com/woocommerce/woocommerce/tree/trunk/plugins/woocommerce/tests/api-core-tests/data) folder.
|
||||
|
||||
|
|
Loading…
Reference in New Issue