---
question: How do I test that a module loads?
kind: guide
---

> **You are reading the v2.x docs (engine modules). New projects use v3.** [Read this page in v3](/capabilities/build/modules/test-a-module) · [Migrate from 2.x to 3.0](/capabilities/upgrade/migrate-to-3)

# Test a module

Test a workflow's `run(...)`, a pipeline's graph, or an integration with its HTTP client mocked. Those calls do not need an engine.

To check that the module loads, build an engine and load it by name:

```python
from naas_abi_core.engine.Engine import Engine

def test_module_loads():
    engine = Engine()
    engine.load(module_names=["my_module"])
    assert "my_module" in engine.modules
```

On ABI 2.x, and on 3.x in a project without NATS, `Engine()` needs no broker. On ABI 3.x in a NATS project, `Engine()` connects to one: run it (`abi dev up` or `abi stack start`), or point `ABI_CONFIG_OVERLAY` at a YAML file that sets `nats: null`.

```bash
uv run pytest tests/test_my_module.py
```

The scaffold and the load hooks are on [Creating a Module](/v2/capabilities/build/modules/creating-a-module#testing).
