Testing
Introduction
Each feature keeps its own tests, and feature:test runs them in five levels. The commands of this section add coverage, linting, load tests and browser tests on top.
splent feature:test
Without flags it runs the unit, integration and functional levels. End-to-end and load tests need a running server, so they run only when you ask.
| Level | Directory | Needs | Run with |
|---|---|---|---|
| Unit | tests/unit/ |
Mocks only, no database, no HTTP | splent feature:test --unit |
| Integration | tests/integration/ |
The test database | splent feature:test --integration |
| Functional | tests/functional/ |
The Flask test client and the database | splent feature:test --functional |
| E2E | tests/e2e/ |
Selenium and a running server | splent feature:test --e2e |
| Load | tests/load/ |
A running server | splent feature:test --load |
--load runs pytest over tests/load/. To start Locust itself, use splent locust.
Narrowing a run
splent feature:test notes --unit # unit tests of notes only
splent feature:test --integration -v # integration tests, verbose
splent feature:test -k test_login # tests whose name matches