# Test Infrastructure **Task**: AZ-189_test_infrastructure **Name**: Test Infrastructure **Description**: Scaffold the blackbox test project — test runner, Docker test environment, seed data fixtures, reporting **Complexity**: 5 points **Dependencies**: None **Component**: Blackbox Tests **Tracker**: AZ-189 **Epic**: AZ-188 ## Test Project Folder Layout ``` e2e/ ├── Azaion.E2E/ │ ├── Azaion.E2E.csproj │ ├── Helpers/ │ │ ├── ApiClient.cs │ │ └── TestFixture.cs │ ├── Tests/ │ │ ├── AuthTests.cs │ │ ├── UserManagementTests.cs │ │ ├── HardwareBindingTests.cs │ │ ├── ResourceTests.cs │ │ ├── SecurityTests.cs │ │ └── ResilienceTests.cs │ └── appsettings.test.json ├── docker-compose.test.yml └── README.md ``` ### Layout Rationale xUnit project with shared test fixture for API client and JWT token management. Tests grouped by domain area matching the blackbox test spec categories. ## Docker Test Environment ### docker-compose.test.yml Structure | Service | Image / Build | Purpose | Depends On | |---------|--------------|---------|------------| | test-db | postgres:16-alpine | PostgreSQL with schema init | — | | system-under-test | Build from Dockerfile | Azaion Admin API | test-db | | e2e-consumer | Build from e2e/ | xUnit test runner | system-under-test | ### Networks and Volumes - `e2e-net`: Isolated test network - `db-init`: SQL scripts mounted to test-db for schema initialization - `test-resources`: Shared volume for resource file upload/download tests ## Test Runner Configuration **Framework**: xUnit 2.9.2 with FluentAssertions 6.12.2 **HTTP Client**: System.Net.Http.HttpClient **Entry point**: `dotnet test` in the e2e-consumer container ### Fixture Strategy | Fixture | Scope | Purpose | |---------|-------|---------| | ApiTestFixture | Collection | Shared HttpClient, admin JWT token, base URL configuration | | UserFixture | Test | Creates/deletes test users per test method | | ResourceFixture | Test | Uploads/cleans test resource files per test method | ## Test Data Fixtures | Data Set | Source | Format | Used By | |----------|--------|--------|---------| | seed-users | SQL init scripts (env/db/) | PostgreSQL rows | All tests | | test-files | Generated at test start | Binary/text files | Resource tests | ### Data Isolation Fresh Docker Compose environment per test run. Test users created during tests are cleaned up via DELETE API. Resource files cleaned via ClearFolder endpoint. ## Test Reporting **Format**: CSV via xUnit test logger **Columns**: Test ID, Test Name, Execution Time (ms), Result (PASS/FAIL/SKIP), Error Message **Output path**: `./e2e-results/report.csv` ## Acceptance Criteria **AC-1: Test environment starts** Given the docker-compose.test.yml When `docker compose -f docker-compose.test.yml up` is executed Then all services start and the system-under-test responds at port 8080 **AC-2: Database initialized** Given the test environment is running When the e2e-consumer connects to the API Then seed users (admin@azaion.com, uploader@azaion.com) exist **AC-3: Test runner executes** Given the test environment is running When the e2e-consumer starts Then the xUnit test runner discovers and executes test files **AC-4: Test report generated** Given tests have been executed When the test run completes Then a CSV report file exists at the configured output path