Rewrite integration tests to run with Docker containers
This commit is contained in:
@@ -183,7 +183,7 @@ Response example:
|
||||
|
||||
- Purpose: **Update a project**
|
||||
- Parameters:
|
||||
- **id** (integer, required)
|
||||
- **project_id** (integer, required)
|
||||
- **name** (string, required)
|
||||
- **description** (string, optional)
|
||||
- Result on success: **true**
|
||||
@@ -197,7 +197,7 @@ Request example:
|
||||
"method": "updateProject",
|
||||
"id": 1853996288,
|
||||
"params": {
|
||||
"id": 1,
|
||||
"project_id": 1,
|
||||
"name": "PHP client update"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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`.
|
||||
### Requirements
|
||||
|
||||
Actually only the API calls are tested.
|
||||
- PHP
|
||||
- Composer
|
||||
- Unix operating system (Mac OS or Linux)
|
||||
- Docker
|
||||
- Docker Compose
|
||||
|
||||
Real HTTP calls are made with those tests.
|
||||
So a local instance of Kanboard is necessary and must listen on `http://localhost:8000/`.
|
||||
### Running integration tests
|
||||
|
||||
All data will be removed/altered by the test suite.
|
||||
Moreover the script will reset and set a new API key.
|
||||
Integration tests are using Docker containers.
|
||||
There are 3 different environment available to run tests against each supported database.
|
||||
|
||||
1. Start a local instance of Kanboard `php -S 127.0.0.1:8000`
|
||||
2. Run the test suite from another terminal
|
||||
|
||||
The same method as above is used to run tests across different databases:
|
||||
|
||||
- Sqlite: `phpunit -c tests/integration.sqlite.xml`
|
||||
- Mysql: `phpunit -c tests/integration.mysql.xml`
|
||||
- Postgresql: `phpunit -c tests/integration.postgres.xml`
|
||||
|
||||
Example:
|
||||
You can use these commands to run each test suite:
|
||||
|
||||
```bash
|
||||
phpunit -c tests/integration.sqlite.xml
|
||||
# Run tests with Sqlite
|
||||
make integration-test-sqlite
|
||||
|
||||
PHPUnit 5.0.0 by Sebastian Bergmann and contributors.
|
||||
# Run tests with Mysql
|
||||
make integration-test-mysql
|
||||
|
||||
............................................................... 63 / 135 ( 46%)
|
||||
............................................................... 126 / 135 ( 93%)
|
||||
......... 135 / 135 (100%)
|
||||
|
||||
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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user