# Start test environment with interactive menu
uv run hamcp-test-env
# Or start in non-interactive mode (for automation/background usage)
uv run hamcp-test-env --no-interactiveFeatures:
- π³ Auto-managed Home Assistant container
- π Interactive menu (run tests, view status, shutdown)
- π€ Non-interactive mode for automation (use
--no-interactive) - π Web UI access:
mcp/mcp - π Multiple test runs without restart
# All E2E tests
uv run pytest tests/src/e2e/ -v
# Fast tests only
uv run pytest tests/src/e2e/ -v -m "not slow"
# Specific categories
uv run pytest tests/src/e2e/basic/ -v # Basic connectivity
uv run pytest tests/src/e2e/workflows/automation/ -v # Automation testsNeed to validate unpublished changes from a feature branch? Use uvx with the
Git URL so you can run the project directly from that branch:
# FastMCP STDIO entry point
uvx --from git+https://github.com/homeassistant-ai/ha-mcp.git@branchname ha-mcp
# FastMCP HTTP server
uvx --from git+https://github.com/homeassistant-ai/ha-mcp.git@branchname ha-mcp-webReplace branchname with the branch you want to exercise (for example,
feature/manual-test-instructions). If you are working from a fork, swap
homeassistant-ai with your GitHub username to target your repository in both
commands. When using these commands, adapt the corresponding uvx setup in
README.md β Method 3: Running Python with UV
so your environment variables and client configuration match the guidance in the
main installation instructions. This ensures your manual testing matches the
code under review.
tests/
βββ src/e2e/ # All test files
β βββ basic/ # Connection & basic tests
β βββ workflows/ # Complex scenarios
β βββ error_handling/ # Error scenarios
βββ initial_test_state/ # Clean HA config baseline
βββ test_env_manager.py # Interactive test runner
βββ pytest.ini # Test configuration
- Basic: Connection, tool listing, entity search
- Workflows: Automation, device control, scripts, scenes
- Error Handling: Invalid inputs, network failures
- Start:
uv run hamcp-test-env - Access Web UI with displayed URL +
mcp/mcpcredentials - Run tests via menu or separate terminal
- Inspect states in Web UI between runs
To update the baseline Home Assistant configuration:
- Clear baseline:
rm -rf tests/initial_test_state/* - Start container:
uv run hamcp-test-env - Setup HA:
- Access Web UI with displayed URL
- Create user:
mcp/ password:mcp - Generate Personal Access Token
- Shutdown: Choose option 2 in menu
- Save state: Copy files from displayed temp directory to
tests/initial_test_state/ - Update token: Replace
TEST_TOKENintests/test_constants.py(centralized location for all test code)