Turn your manual testers into automation experts Request a DemoStart testRigor Free

WooCommerce Testing

WooCommerce Testing

WooCommerce transforms ordinary WordPress websites into complete online shops with its open-source and adaptable features. It has many different functions, such as safe payment methods, adjustable delivery choices, and so on, which you can customize for your own business requirements.

The plugin comes with many add-ons that provide extra features like making reservations, handling recurring payments, and working together with different software applications. WooCommerce is mainly created with PHP, the same programming language that WordPress uses.

PHP is a server-side scripting language widely used for web development. Besides PHP, WooCommerce utilizes different web technologies for both its user interface and server-side operations.

According to the testing pyramid, you can test your WooCommerce application through

Unit Testing

As a project grows, it becomes difficult to keep track of every single method and class written. Through unit testing, you can ensure that your methods and classes, that is, various units of code, are working as expected.

Like WordPress, WooCommerce works with PHP. Thus, PHPUnit is the best way to get your unit testing done. When it comes to unit testing, you want your test cases to be lightweight and focus on just a single outcome at a test case level. You can make use of stubs and mocking to mimic all those complex WordPress functionalities without booting the entire application for every test run.

There are some pre-defined unit tests that you can import and use to test your project, along with creating custom test cases. Using these pre-defined test cases also gives you access to a couple of useful helper functions, like creating customers or sample orders.

Here’s a sample test case of a unit test in PHPUnit for scenarios where the product is on sale versus when it is not on sale.
// Use the necessary PHPUnit and WooCommerce classes

class ProductFunctionsTest extends TestCase {
  private $product_id_on_sale;
  private $product_id_not_on_sale;

  protected function setUp(): void {
    $this->product_id_on_sale = $this->create_product(true);  //on sale product
    $this->product_id_not_on_sale = $this->create_product(false); //not on sale product

  private function create_product($on_sale) {
    $product = new WC_Product_Simple();
    if ($on_sale) {

    return $product->get_id();

  // Test if 'is_product_on_sale' returns true for products on sale
  public function testProductOnSale() {
    $this->assertTrue(is_product_on_sale($this->product_id_on_sale), 'Product should be on sale');

  // Test if 'is_product_on_sale' returns false for products not on sale
  public function testProductNotOnSale() {
    $this->assertFalse(is_product_on_sale($this->product_id_not_on_sale), 'Product should not be on sale');

  // Clean up the created products
  protected function tearDown(): void {

Integration Testing

Through integration testing, you can ascertain if different modules are working properly together or not. In websites dealing with online stores, you will have the need for this. As the project grows, you need to have such checks and balances where the interworking of modules is tested instead of relying completely on end-to-end testing for it.

Here are some scenarios where you might need to perform integration testing:

  • Plugins/Extensions: You need to test how your own-made plugins or extensions from others work with WooCommerce’s main functions.
  • External Services: When we do integration testing, it also includes checking how well the system works with outside services like those that calculate shipping costs, figure out taxes, manage customer relationships, and analyze data.
  • Subscriptions: When your application integrates WooCommerce subscriptions, it’s important to check the ongoing payment system, the renewal of subscriptions, and how users control their subscriptions.
  • Order Management UI: Checking the connection between our system for handling orders and what customers see on their screens covers placing orders, tracking order progress, managing stock levels, and linking up with delivery services.
  • Account Management Services: Making certain that the functionalities for user sign up, signing in, password changing, and managing account details integrate smoothly with the WooCommerce shop.

You can use the same tools you used for unit testing, like PHPUnit, to write integration tests.

End-to-End Testing

Imagine if your customer placed an order but is not able to see a confirmation for the same. This will impact business and create a bad reputation for the company. When it comes to websites behaving as storefronts, ensuring that common workflows are functioning properly is a must-have.

This is where end-to-end testing comes in, as it looks at verifying user workflows. End-to-end testing is focused on the user’s experience of the product rather than the developer’s.

There are many tools in the market that can be used to perform end-to-end testing on WooCommerce-based applications.


Selenium is a well-known open-source framework that enables you to automate many different testing scenarios from start to finish. WebDriver plays a vital role in Selenium, enabling users to program browser tasks like opening websites, clicking on links, completing forms, and retrieving information from web pages.

Selenium also gives ways to confirm and check different elements and attributes on websites, helping users make sure the expected actions and information are correct. It supports various programming languages like Java, Python, C#, Ruby, and more.

However, Selenium has limitations, such as the need for a lot of work to maintain tests, challenges with testing across different platforms, and some instability from using locators based on elements like CSS and XPaths.


Software testing has come a long way since the incorporation of AI. This has made it simpler to create tests and lessened the time needed for maintaining them, expanding its influence broadly.

Evidence can be seen in the growing amount of tools for test automation that provide these advantages. One such generative AI-powered tool is testRigor.

testRigor overcomes Selenium’s limitations by leveraging AI to give you a seamless testing experience. It emulates a human tester to give you an unparalleled experience.

Using this tool you can create test cases in plain English language without worrying about XPaths or CSS locators of UI elements. Even test maintenance efforts are reduced drastically through self-healing.

Here’s a test case example of how your scripts will look in testRigor.
navigate to catalog
check that page contains "Chargable toothbrush C511X" to the left of "$50"
click on "Order" below "Chargable toothbrush C511X"
check that page contains "Chargable toothbrush C422W" to the left of "$60"
click "Order" below "Chargable toothbrush C422W"
click "cart"
click "checkout"
check that page contains "2 items"
check that page contains "Order total : $110"

Not just that, it also offers great features that make testing easy across different platforms. This proves useful since WooCommerce can also be integrated into mobile apps for cross-platform testing. If you wish to integrate your tests with CI/CD pipelines, you can easily do so by utilizing the various integrations testRigor offers.


Using WooCommerce, you can make your website function as an online store with ease. As it is an open-source plugin, you can modify the existing functions to match what you need.

But for businesses using WooCommerce, you need a test automation tool that makes very little trouble and provides precise testing outcomes quickly. Before you decide on testing tools, make sure to do careful research and choose one that meets your requirements.

Join the next wave of functional testing now.
A testRigor specialist will walk you through our platform with a custom demo.