diff options
Diffstat (limited to 'doc/tests.markdown')
-rw-r--r-- | doc/tests.markdown | 62 |
1 files changed, 42 insertions, 20 deletions
diff --git a/doc/tests.markdown b/doc/tests.markdown index b2d95491..59177f87 100644 --- a/doc/tests.markdown +++ b/doc/tests.markdown @@ -9,9 +9,11 @@ Requirements ------------ - Linux/Unix machine -- PHP cli +- PHP - PHPUnit installed - Mysql and Postgresql (optional) +- Selenium (optional) +- Firefox (optional) Unit Tests ---------- @@ -83,39 +85,59 @@ From your Kanboard directory, run the command `phpunit -c tests/units.postgres.x Integration Tests ----------------- -Actually only the API calls are tested. +Integration tests are mainly used to test the API. +The test suites are making real HTTP calls to the application that run inside a container. -Real HTTP calls are made with those tests. -So a local instance of Kanboard is necessary and must listen on `http://localhost:8000/`. +### Requirements -All data will be removed/altered by the test suite. -Moreover the script will reset and set a new API key. +- PHP +- Composer +- Unix operating system (Mac OS or Linux) +- Docker +- Docker Compose -1. Start a local instance of Kanboard `php -S 127.0.0.1:8000` -2. Run the test suite from another terminal +### Running integration tests -The same method as above is used to run tests across different databases: +Integration tests are using Docker containers. +There are 3 different environment available to run tests against each supported database. -- Sqlite: `phpunit -c tests/integration.sqlite.xml` -- Mysql: `phpunit -c tests/integration.mysql.xml` -- Postgresql: `phpunit -c tests/integration.postgres.xml` +You can use these commands to run each test suite: + +```bash +# Run tests with Sqlite +make integration-test-sqlite + +# Run tests with Mysql +make integration-test-mysql + +# Run tests with Postgres +make integration-test-postgres +``` + +Acceptance Tests +---------------- + +Acceptance tests (also sometimes known as end-to-end tests, and functional tests) test the actual functionality of the UI in a browser using Selenium. + +In order to run these tests you must have [Selenium Standalone Server](http://www.seleniumhq.org/download/) installed, and a compatible version of Firefox. + +The PHPUnit config file is `tests/acceptance.xml`. +With Selenium and the Kanboard app running, from your Kanboard directory, run the command `make test-browser`. This will initiate the testing suite and you will see Firefox open automatically and perform the actions specified in the acceptance tests. Example: ```bash -phpunit -c tests/integration.sqlite.xml +$ make test-browser +PHPUnit 4.8.26 by Sebastian Bergmann and contributors. -PHPUnit 5.0.0 by Sebastian Bergmann and contributors. - -............................................................... 63 / 135 ( 46%) -............................................................... 126 / 135 ( 93%) -......... 135 / 135 (100%) +.. -Time: 1.18 minutes, Memory: 14.75Mb +Time: 5.59 seconds, Memory: 5.25MB -OK (135 tests, 526 assertions) +OK (2 tests, 5 assertions) ``` + Continuous Integration with Travis-CI ------------------------------------- |