Before asking how to test your modules on multiple versions of PrestaShop, the real question is: why should you? The answer is straightforward. Your users rely on the open-source platform on their own servers and may be running vastly different versions of PrestaShop.
What are the risks of not verifying compatibility?
Failing to ensure compatibility can lead to several issues:
- Increased support requests
- Lower ratings (if you sell on a marketplace)
- A damaged reputation for your module (and consequently for your brand)
How to verify compatibility?
To verify a module’s compatibility, the first step is to perform a static code analysis. This ensures that your module’s code aligns with the Core code of PrestaShop.
I recommend checking out Jonathan Danse’s article: Testing and Automatically Analyzing Your Modules.
Once your code is deemed compatible, the next question arises: does the module behave the same across all supported PrestaShop versions? Addressing this requires the second step—automated testing.
Tools for Testing Your Modules
To test your module’s behavior, installing every PrestaShop version daily isn’t feasible. Instead, automation is key.
Essential Tools:
- Testing Environment: We’ll use Docker.
- Testing Platform: We’ll rely on GitHub Actions (though the approach applies to GitLab CI as well).
- Testing Library: We’ll use
@playwright/test
, included in@prestashop-core/ui-testing
.
What Processes Should You Implement?
Define the Testing Campaign
Your campaign outlines all the tests you would manually perform. For example:
- Module Installation
- Verify default settings.
- Confirm the module is hooked to the correct hooks.
- Module Uninstallation
- Ensure the module is removed from all hooks.
Your module likely has more functionalities than just installation and uninstallation. Start by listing all its features, then expand your test scenarios based on past support tickets.
Define the Range of PrestaShop Versions
You know your module’s minimum and maximum supported PrestaShop versions. Now decide which versions to test:
- Major Versions Only:
1.7.8.11
8.2.0
- Latest Minor Versions:
1.7.1.2
1.7.2.5
1.7.3.4
1.7.4.4
1.7.5.2
1.7.6.9
1.7.7.8
1.7.8.11
8.0.5
8.1.5
8.2.0
- Every Minor Version
- Next Version (
nightly
)
If the list is extensive, prioritize the most-used versions or those generating the highest support demand.
Define the Workflow
Now that you know what to test and on which PrestaShop versions, the final question is: When should you run the tests?
Options include:
- Nightly Tests: On your development branch.
- Pull Request Tests: To ensure new developments or bug fixes don’t break existing functionality.
- On-Demand Testing
Conclusion
Answering these questions is the foundation of ensuring high compatibility for your module. The long-term benefits are clear: increased customer satisfaction and fewer bugs, which means less support.
In a future article, we’ll set up this architecture for a module.