GUIDE 19 ยท QUALITY5 min read
Automated testing
Run the framework test suite or generate application endpoint checks and CSV reports.
IN THIS GUIDE
Work through each step in order. The examples use the generated LenAPI project structure and are designed to be adapted to your app.
01
Run application checks
Inside a generated application, the LenAPI CLI can inspect endpoints, generate tests, execute the suite, and write a CSV report under outputs/.
Python
python lenora.py test02
Generate and run tests separately
Use separate commands when you want to inspect the generated endpoint tests or execute them later. The CSV-output command writes endpoint and pytest results.
Python
python lenora.py generate_test
python lenora.py run_test
python lenora.py run_test_output03
Test route logic directly with ASGI clients
Use HTTPX's ASGI transport to exercise an application without opening a network port. Keep test databases isolated from development or production data.
Python
import httpx
async def test_health(app):
transport = httpx.ASGITransport(app=app)
async with httpx.AsyncClient(
transport=transport, base_url="http://test"
) as client:
response = await client.get("/health")
assert response.status_code == 200