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

PrestaShop Testing

PrestaShop is a free, open-source e-commerce platform that enables businesses to create and manage their online stores. Launched in 2007, it has become one of the most popular e-commerce solutions globally due to its user-friendly interface, extensive customization options, and a wide range of features.

PrestaShop is built on the PHP programming language and uses MySQL for database management. It offers a variety of built-in features, such as product and inventory management, payment gateway integrations, multi-language and multi-currency support, marketing tools, and order management. Additionally, its modular architecture allows users to extend its functionality with plugins and themes available from the PrestaShop marketplace.

In this framework, you have the capability to customize the following:

A default set of themes and modules are made available to you as a part of the original project. However, you can apply further customizations to make sure that your website grows and behaves the way you want it to. Prestashop also allows you to host your website easily.

As per the testing pyramid, here’s the most popular way to structure your testing efforts for a PrestaShop application:

Unit Testing

Unit testing involves testing individual units or components of a software application. A unit is typically the smallest testable part of the code, such as a function or method. The primary purpose of unit testing is to validate that each unit of the software performs as expected. By breaking down the application into small, manageable units, developers can identify and fix issues early in the development process. This helps improve the overall quality and reliability of the software.

PrestaShop supports the PHPUnit framework. It is essential to have a clean folder structure. In Prestashop, the unit test case should be located in the tests/Unit folder and have the same path as the tested class. For example, if the class to be tested is in src/Core/Foo/Baz, then the unit test should be in the tests/Unit/Core/Foo/Baz folder.

Using the TestCase class to base your unit tests on is advisable. It will look something like this.
  namespace Tests\Unit\Foo;
  use PHPUnit\Framework\TestCase;
  class BarTest extends TestCase
    /* ... */
Unit tests can look something like this.
use PHPUnit\Framework\TestCase;

class EqualsTest extends TestCase
  public function testFailure()
    $this->assertEquals(1, 0);

  public function testFailure2()
    $this->assertEquals('bar', 'baz');
The above example is a basic depiction of using assert methods to validate results. Below is another example of a unit test.
use PHPUnit\Framework\TestCase;
class DependTest extends TestCase
  public function testEmpty()
    $value = [];
    return $value;

   * @depends testEmpty

  public function testPush(array $value)
    array_push($value, 'first');
    $this->assertEquals('first', $value[count($value) - 1]);
    return $value;

Integration Testing

The next step after testing different units in your code in isolation is to see if they also work together well. This is where integration testing comes into the picture. You can plan your test cases such that the integrations at crucial junctions are tested.

For example, if your e-commerce website is to call a third-party payment gateway, then you can have positive and negative integration tests revolving around this scenario. Other areas that you can target for integration testing could be places where there are integrations with databases, file management systems, and any third-party applications.

Below are a couple of integration test case examples.
namespace Tests\Integration;
use Tests\TestCase;

class MathTest extends TestCase
  public function setUp()
    $this->math = $this->app->make('App\Math');

  public function test_getArea_WhenCalledWithLength2_Return4()
    $response = $this->math->getArea(2);
    $this->assertEquals(4, $response);
 function testSavingUser()
  $user = new User();
  $this->assertEquals(Erica Jones, $user->getFullName());
  $this->tester->seeInDatabase('users', ['name' => Erica, 'surname' => Jones]);

End-to-End Testing

End-to-end or system testing verifies the behavior and performance of an application from start to finish, covering the entire system flow or business process. This type of testing is also known as "black-box testing," as it focuses on the functionality of the application without requiring knowledge of the internal workings of the system.

The goal of end-to-end testing is to simulate real-world scenarios and identify any issues or defects that may arise when actual users use the application. It typically involves testing the application as a whole, including its interfaces with external systems, databases, and other dependencies.

You can do that using the following ways.
  • UI testing with supported tools
  • Selenium-based tools
  • testRigor

UI testing with supported tools: Playwright, Mocha, Chai, Faker

Prestashop offers support to automate UI scenarios with the help of the following tools. It uses
  • Playwright as the automation tool
  • Mocha as the testing framework
  • Chai as the assertion library
  • Faker as the mock data generator
Below is an example of using Playwright to manage browser manipulations, Mocha to define the test framework, and Chai for performing the assertions. The test case below checks if the to-do list loaded is empty and whether a new item gets added to the list.
const playwright = require('playwright')
const chai = require('chai')
const expect = chai.expect
const BASE_URL = 'http://todomvc.com/examples/react/#/'

// playwright variables
let page, browser, context

describe('TO DO APP TESTS - PLAYWRIGHT', () => {
  beforeEach(async () => {
    browser = await playwright['chromium'].launch({ headless: false })
    context = await browser.newContext()
    page = await context.newPage(BASE_URL)
  afterEach(async function() {
    await page.screenshot({ path: `${this.currentTest.title.replace(/\s+/g, '_')}.png` })
    await browser.close()

  it('List is loaded empty', async() => {
    const sel = 'ul.todo-list li'
    const list = await page.$$(sel)

  it('Adds a new todo in empty list', async() => {
    await page.waitForSelector('input')
    const element = await page.$('input')
    await element.type('Practice microsoft playwright')
    await element.press('Enter')

    // check list of ToDo
    const sel = 'ul.todo-list li'
    await page.waitForSelector(sel)
    const list = await page.$$(sel)
    expect(await page.$eval(sel, node => node.innerText)).to.be.equal('Practice microsoft playwright')

testRigor for end-to-end testing

testRigor is one of the easiest ways to cover your entire application with robust end-to-end tests. Why? Because it's a no-code AI-driven tool and solves a lot of the tricky aspects associated with writing and maintaining complex end-to-end UI tests.

Initial setup takes only a few minutes, and even less technical people can start writing tests, add assertions, and easily modify existing tests when needed. This results in being able to write tests up to 15x faster than with Selenium-based tools, and spending up to 95% less time on test maintenance - thanks to testRigor being packed with smart features.

Moreover, you can do cross-platform and cross-browser testing without major configuration steps. testRigor also allows 2FA, email testing, and SMS testing - included at no extra cost.

Let us consider the example from the UI testing using the supported tools section above. There is an application in React for creating a to-do list. The code has 2 test cases within the describe() block. When considering the test case in testRigor, things become much easier. Firstly, you need to create a test suite. During this suite creation, you can give the URL so that every time a new test case from this suite runs, a fresh instance of the application is opened in the browser. You can also specify the browser of your choice from the suggested options. This covers your beforeEach() block from the above code. As you can tell, it is much simpler than creation explicit conditions.

Your actual test case will look like this:
check that page does not contain checkboxes below "what needs to be done?"
enter "Buy groceries for Friday dinner" into "What needs to be done?"
enter enter into "testrigor.com test"
check that page contains "Buy groceries for Friday dinner" below "What needs to be done?"

In the afterEach() block, testRigor automatically takes screenshots of every step. Each test case run captures detailed screenshots along with a video recording of the whole test execution.


With e-commerce website building, it becomes imperative to have reliable, well-tested building blocks. If the framework offers various modules and themes, they should be user-friendly. For instance, Prestashop provides many options for building your website, including the ability to use provided blocks or customize them to suit your needs. Once your website is operational, the good testing strategies described in this article can help you build a strong testing strategy.