{% extends "base.html" %} {% block title %}Testing Framework{% endblock %} {% block breadcrumb %}Testing Framework{% endblock %} {% block extra_head %} {% endblock %} {% block content %} {# ═══════════════════════════════════════════════════════════════════ AQUILIA ADMIN — TESTING FRAMEWORK (v2 — Enhanced) Phase 31f: Comprehensive testing analytics dashboard ═══════════════════════════════════════════════════════════════════ #}
Aquilia Testing v{{ framework_version }} — batteries-included testing integrated with every subsystem
| Name | Module | Description | Features |
|---|---|---|---|
{{ mock.name }}
|
{{ mock.module }} | {{ mock.description }} |
{% for feat in mock.features %}
{{ feat }}
{% endfor %}
|
{{ method }}
{% endfor %}
{{ fix.name }}
{% if fix.async %}
async
{% endif %}
{{ util.name }}
| File | Category | Dir | Lines | Tests | Asserts | Density | Async | Sync |
|---|---|---|---|---|---|---|---|---|
{{ f.name }}
|
{{ f.category|default('other') }} | {{ f.directory }} | {{ "{:,}".format(f.lines) }} | {{ f.test_count }} | {{ f.assert_count|default(0) }} | {{ "%.1f"|format(f.density|default(0)) }} | {{ f.async_tests|default(0) }} | {{ f.sync_tests|default(0) }} |
| Total | {{ "{:,}".format(summary.total_lines) }} | {{ summary.total_test_functions }} | {{ "{:,}".format(total_assert_stmts) }} | {{ "%.1f"|format(avg_density) }} | {{ total_async_tests }} | {{ total_sync_tests }} | ||
Copy-paste examples for Aquilia's testing utilities.
from aquilia.testing import AquiliaTestCase
class TestUserService(AquiliaTestCase):
"""Unit test for user service logic."""
async def test_create_user(self):
result = await self.app.di.get("user_service").create(
name="Alice", email="alice@example.com"
)
self.assert_status(result, 201)
self.assert_json_has(result, "id", "name")
async def test_user_validation(self):
with self.assertRaises(ValidationError):
await self.app.di.get("user_service").create(name="")from aquilia.testing import AquiliaTestCase
class TestAuthFlow(AquiliaTestCase):
"""Integration test across auth + sessions + DI."""
async def test_login_creates_session(self):
resp = await self.client.post("/auth/login", json={
"username": "admin", "password": "secret"
})
self.assert_status(resp, 200)
self.assert_json_has(resp, "token")
# Verify session was created
sessions = self.app.di.get("session_store")
self.assertTrue(len(sessions.active()) > 0)from aquilia.testing import TestClient
async def test_api_endpoints():
"""Use TestClient for HTTP testing without network."""
async with TestClient(app) as client:
# GET request
resp = await client.get("/api/users")
assert resp.status == 200
# POST with JSON body
resp = await client.post("/api/users", json={
"name": "Bob", "role": "editor"
})
assert resp.status == 201
# Custom headers
resp = await client.get("/api/profile", headers={
"Authorization": "Bearer test-token"
})from aquilia.testing import AquiliaTestCase
from aquilia.testing import MockFaultEngine, MockEffectBus
class TestWithMocks(AquiliaTestCase):
"""Use mock infrastructure for isolated testing."""
async def test_fault_handling(self):
faults = MockFaultEngine()
faults.inject("db_timeout", probability=1.0)
with self.mock_subsystem("faults", faults):
resp = await self.client.get("/api/data")
self.assert_status(resp, 503)
async def test_effect_bus(self):
bus = MockEffectBus()
await bus.emit("user.created", {"id": 1})
bus.assert_emitted("user.created", count=1)import pytest
from aquilia.testing import create_test_app, seed_database
@pytest.fixture
async def app():
"""Create a fresh test application instance."""
app = await create_test_app(config={
"database": {"url": "sqlite://:memory:"},
"auth": {"secret": "test-secret"},
})
yield app
await app.shutdown()
@pytest.fixture
async def seeded_app(app):
"""App with seed data for integration tests."""
await seed_database(app, fixtures=["users", "posts"])
return appHow many test files import each Aquilia testing utility.
{{ name }}
{{ count }} files