# Testing

A Jadpo test runs your real application against a real database. Only
the outside world and the clock are replaced: every call to an outside
service answers from a fake, and the clock stands still until the test
moves it. You don't mock your own actions, and there is no in-memory
stand-in for the database.

This page covers where tests live, the kinds of test, the settings a test
takes, acting as a user, controlling time, configuration and fakes in
tests, shared test data, assertions, running tests, the test database,
and how tests meet caches and events.

Most examples use a todo app's `planning` domain, the folder that holds
one business area of the app. It has `User` and `Todo` entities (kinds of
stored record), a `create_todo` action, a `TodoNotFound` failure, an
`overdue_reminders` schedule and a `ReminderMail` integration with an
outside email service.

| Page | What it covers |
|---|---|
| [Where tests live](/docs/where-tests-live.md) | A test sits beside the file it tests, in a file named `<name>.test.jadpo`. |
| [Writing a test](/docs/writing-a-test.md) | A test is a sentence that names it, then a body of ordinary code. |
| [Kinds of test](/docs/kinds-of-test.md) | Jadpo works out a test's kind from what it calls, so you don't declare it. |
| [Test settings](/docs/test-settings.md) | A test needs no settings. |
| [Acting as a user](/docs/acting-as-a-user.md) | An action receives its caller, the person or service signed in, as a typed parameter (The principal). |
| [Controlling time](/docs/controlling-time.md) | A test never waits for real time. |
| [Configuration in tests](/docs/configuration-in-tests.md) | A test never reads your machine's environment. |
| [Fakes for integrations](/docs/fakes-for-integrations.md) | A test never reaches a real provider, the outside service an integration talks to. |
| [Shared test data: fixtures](/docs/shared-test-data-fixtures.md) | When several test files need the same data, write a fixture. |
| [Assertions](/docs/assertions.md) | `assert condition` fails the test when the condition is false. |
| [Running tests](/docs/running-tests.md) | `jadpo test` runs every test in the project, and owns everything a run needs, so nothing about it appears in your source. |
| [The test database](/docs/the-test-database.md) | Each test gets its own database at the latest migration, empty except for what its fixtures create. |
| [Events and caches in tests](/docs/caches-and-events.md) | An event is a fact an action records, such as "an order was placed", and a subscriber is code that runs when one is delivered (Subscribers). |

[What is built](/docs/testing-built.md) says which of this works today.
