These libraries and frameworks often were created to provide consistent execution and results, as well as for fast and efficient execution of tests. In addition, many of them were started to make testing easier, so writing and running tests fit in easier into the development workflow, rather than being a hinderance. These often plug into Continuous Integration/Delivery (CI/CD) pipelines which allow for continuous testing and results, and provide confidence on code changes prior to deployment. Issues can be found early, and the output from these tools, frameworks, and libraries make it easy to narrow down the cause and look into a solution.
PHPUnit is a unit testing framework for PHP, which is built off of the xUnit architecture. If you have worked with similar tools such as JUnit, the API will be very familiar. PHPUnit is used for building out and running unit tests, such as those in WooCommerce. For information on how to run these tests in WooCommerce, check out the instructions.
Puppeteer is a Node library that is used for testing the UI of an application, and is commonly used in end-to-end testing. It runs tests using the Chrome or Chromium browser, and can be run in either in headless (no UI) or non-headless (opens and displays the browser). WooCommerce uses Puppeteer for the core end-to-end tests that go through and verify the critical flows are working as expected.
@woocommerce/e2e-utils package provides useful utility methods to make writing e2e tests for WooCommerce and extensions easier.
@woocommerce/api package provides an API client to interact with the WooCommerce and WordPress APIs. It can be used to create products that would take up valuable test execution time if you were to create them via the UI instead. For example, this is used in the WooCommerce end-to-end tests for setting up variable products to be used in tests.
Note that this package is also required when using
This package provides an end-to-end testing environment for WooCommerce, and includes configurations for the test runner, screenshots, and Slackbot. In addition, the package also provides support for Travis CI/GitHub Actions and a testing environment. This environment package powers the WooCommerce end-to-end testing environment.
WooCommerce E2E Tests Boilerplate
The WooCommerce E2E Tests Boilerplate provides a really helpful way of orchestrating the e2e packages for testing and bootstrapping setting up end-to-end tests for plugins.