-
Notifications
You must be signed in to change notification settings - Fork 3
Testing
Explains how testing is done in athene2.
Individual units of source code, mainly the UI independent ones, should be tested with the help of PHPUnit.
Because of compatibility issues with Zend Framework version 2.4 an older version of PHPUnit (version 5) is used. PHPUnit is integrated in the athene2 project as dev-dependence via Composer.
See https://phpunit.de/getting-started/phpunit-5.html for more infos.
To run all available tests on your developer machine you can use
yarn unit
To run all unit tests of athene2 within your running athene2 docker container simply use
docker exec -it CONTAINERID ./src/vendor/bin/phpunit
To run a specific testsuite, for example "Blog" (see phpunit.xml):
yarn unit --testsuite "Blog"
If you want to run unit tests via your IDE, for example PHPStorm, please make sure that you indicate the phpunit.xml file correctly.
In PHPStorm: "Edit configurations..." -> "Use alternative configuration file"
There are a few base classes to ease testing manager- and entityclasses.
Find them in this directory within the athene2 project:
src/test/AtheneTest/TestCase
Simply extend these base classes, use the implemented helper functions and start writing your own tests.
Examples:
src/module/Blog/test/BlogTest/Manager/BlogManagerTest.php
src/module/Blog/test/BlogTest/Entity/PostTest.php
EndToEnd testing is done with https://www.cypress.io/ and is integrated into athene2 via yarn.
To start cypress locally use:
yarn e2e
TODO: document CI/Staging/Environments, when configured
You can find athene2 cypress test files in the following folder:
/cypress/integration
How to write your first test: https://docs.cypress.io/guides/getting-started/writing-your-first-test.html
Please follow the cypress best practises: https://docs.cypress.io/guides/references/best-practices.html#article