diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index b2f1b02d04a..b603f2378b8 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -37,9 +37,9 @@ 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. You can check the following guides for this purpose: - - [Writing unit tests](https://github.com/woocommerce/woocommerce/blob/trunk/plugins/woocommerce/tests/README.md#writing-tests). - - [Writing API tests](https://github.com/woocommerce/woocommerce/tree/trunk/plugins/woocommerce/tests/api-core-tests#guide-for-writing-tests). +- 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. diff --git a/plugins/woocommerce/tests/README.md b/plugins/woocommerce/tests/README.md index 7d931f510e9..3390af5ac24 100644 --- a/plugins/woocommerce/tests/README.md +++ b/plugins/woocommerce/tests/README.md @@ -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 `` 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: diff --git a/plugins/woocommerce/tests/api-core-tests/README.md b/plugins/woocommerce/tests/api-core-tests/README.md index db6e49ef917..747e672b086 100644 --- a/plugins/woocommerce/tests/api-core-tests/README.md +++ b/plugins/woocommerce/tests/api-core-tests/README.md @@ -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.