TestMe API Tests¶
An API test suite for the TestMe test case management app (API documentation). It uses Playwright's APIRequestContext as the HTTP client together with pytest and Pydantic, and covers authentication, test case management, lists and statistics, with markers for running focused subsets.
What's Covered¶
- Authentication — login/logout happy path, invalid credentials and edge cases, CSRF token retrieval and reuse
- Test cases — create, read, update, delete and PASS/FAIL status changes
- Workflows — full CRUD plus status, authorization and error handling
- Lists and pagination — list endpoints with and without pagination, page/size combinations and boundaries
- Statistics — structure validation, model parsing and consistency checks
How It's Built¶
- Client pattern — separate
AuthClient,TestCasesClientandStatsClient, with shared HTTP logic (headers, CSRF, logging) inBaseClient. - Pydantic models — request and response models for test cases, statuses, statistics and errors.
- Fixtures — a session-level
APIRequestContext, authenticated clients and acreated_test_idfixture that creates and cleans up a test case. - Markers —
smoke,regression,auth,tests,stats,positive,negative, each with amaketarget. - Parallel execution —
pytest-xdistviamake test-parallel. - Dual logging — HTTP requests and responses go to
logs/and to the pytest-html report.
Tech Stack¶
pytest— testing frameworkplaywright/pytest-playwright— HTTP client (APIRequestContext) and pytest integrationpytest-xdist— parallel test executionpytest-html— HTML reports with embedded logspydantic,pydantic-settings— data models and configurationfaker— test data generationpython-dotenv— environment configurationuv— Python package managerruff— linter and formatter
Running It¶
Install dependencies, then run the tests with or without an HTML report:
make install
make test
make test-html