Skip to main content

Integration tests file structure

Tests for each integration are stored inside a directory named after the integration domain. For example, tests for the mobile app integration should be stored in tests/components/mobile_app.

The content of this folder looks like this:

  • Required for pytest to find the tests, you can keep this file limited to a docstring introducing the integration tests """Tests for the Mobile App integration.""".
  • Pytest test fixtures
  • Tests testing a corresponding part of the integration. Tests of functionality in, for example setting up, reloading and unloading a config entry, should be in a file named

Sharing test fixtures with other integrations

If your integration is an entity integration which other integrations have platforms with, for example light or sensor, the integration can provide test fixtures which can be used when writing tests for other integrations.

For example, the light integration may provide fixtures for creating mocked light entities by adding fixture stubs to tests/components/, and the actual implementation of the fixtures in tests/components/light/