This is PrestaShop automated tests folder.
Multiple type of tests are available:
E2E
andSelenium
folders contains end-to-end testsUnit
folder contains unit tests, see below
PrestaShop unit tests are powered by phpunit.
- One php class = one test file.
- The test filepath must follow the class filepath/
- Every dependency of the class must be replaced by test doubles*.
*If there is a hard-coded dependency such as a singleton pattern being used or a static call, this class cannot be unit tested and should be tested using integration tests.
- Use camelCase names for test function names.
- Try to make method names explain the intent of the test case as best as possible. Don't hesitate to write long method names if necessary.
- Bad example:
testGetPrice
(no idea what such a test is supposed to do) - Good example:
testDiscountIsAppliedToFinalPrice
- Bad example:
PrestaShop integration tests are powered by behat.
PrestaShop end-to-end tests are powered by a tool suite as it requires:
- to control a browser behavior
- to mimic a user's behavior
- to setup a test case and validate the behavior