Testing

Learn how to write and run tests for your RouteMQ application.

Topics

Quick Overview

Run the test suite:

python run_tests.py

# Or using uv
uv run pytest

Writing Tests

Create your tests in the tests/ directory:

Test Organization

Best Practices

  • Test Each Component: Controllers, middleware, models separately

  • Mock External Dependencies: Redis, database, MQTT client

  • Use Descriptive Names: Clear test method names

  • Test Edge Cases: Error conditions and boundary values

  • Keep Tests Fast: Use mocks to avoid slow operations

Next Steps

Last updated