From 922e0fb6de06a98774418612e0b0f75af72b6dbb Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 25 Jun 2016 14:34:46 -0400 Subject: Rewrite integration tests to run with Docker containers --- doc/tests.markdown | 49 ++++++++++++++++++++----------------------------- 1 file changed, 20 insertions(+), 29 deletions(-) (limited to 'doc/tests.markdown') diff --git a/doc/tests.markdown b/doc/tests.markdown index 5e3d71d2..59177f87 100644 --- a/doc/tests.markdown +++ b/doc/tests.markdown @@ -9,7 +9,7 @@ Requirements ------------ - Linux/Unix machine -- PHP cli +- PHP - PHPUnit installed - Mysql and Postgresql (optional) - Selenium (optional) @@ -85,46 +85,37 @@ From your Kanboard directory, run the command `phpunit -c tests/units.postgres.x Integration Tests ----------------- -Acceptance tests (also known as end-to-end tests and sometimes functional tests) allow us to test the actual functionality of the browser using Selenium and PHPUnit. +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. -The PHPUnit config file is `tests/acceptance.xml`. -From your Kanboard directory, run the command `phpunit -c tests/units.sqlite.xml`. - -Actually only the API calls are tested. - -Real HTTP calls are made with those tests. -So a local instance of Kanboard is necessary and must listen on `http://localhost:8000/`. - -All data will be removed/altered by the test suite. -Moreover the script will reset and set a new API key. +### Requirements -1. Start a local instance of Kanboard `php -S 127.0.0.1:8000` -2. Run the test suite from another terminal +- PHP +- Composer +- Unix operating system (Mac OS or Linux) +- Docker +- Docker Compose -The same method as above is used to run tests across different databases: +### Running integration tests -- Sqlite: `phpunit -c tests/integration.sqlite.xml` -- Mysql: `phpunit -c tests/integration.mysql.xml` -- Postgresql: `phpunit -c tests/integration.postgres.xml` +Integration tests are using Docker containers. +There are 3 different environment available to run tests against each supported database. -Example: +You can use these commands to run each test suite: ```bash -phpunit -c tests/integration.sqlite.xml - -PHPUnit 5.0.0 by Sebastian Bergmann and contributors. +# Run tests with Sqlite +make integration-test-sqlite -............................................................... 63 / 135 ( 46%) -............................................................... 126 / 135 ( 93%) -......... 135 / 135 (100%) +# Run tests with Mysql +make integration-test-mysql -Time: 1.18 minutes, Memory: 14.75Mb - -OK (135 tests, 526 assertions) +# 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. -- cgit v1.2.3