Test management service for organizing test cases by features and stories, running test suites, and uploading JUnit XML results via CLI. Includes a web UI for browsing and managing everything.
- Web + API: Next.js (React) with App Router + API Route Handlers + SQLite (better-sqlite3)
- CLI: TypeScript CLI (commander.js)
- Monorepo: npm workspaces
npm installStart the app (port 3001):
cd packages/web
npm run devThis serves both the web UI and the API at http://localhost:3001.
Populate the database with demo data:
cd packages/web
npm run seedThis creates a "Demo Project" with features, stories, and test cases.
All endpoints are under /api.
GET /api/projects
POST /api/projects { "name": "My Project" }
GET /api/projects/:id
PUT /api/projects/:id { "name": "New Name" }
DELETE /api/projects/:id
GET /api/features?project_id=1
POST /api/features { "project_id": 1, "name": "Auth" }
PUT /api/features/:id { "name": "New Name" }
DELETE /api/features/:id
GET /api/stories?feature_id=1
POST /api/stories { "feature_id": 1, "name": "Login" }
PUT /api/stories/:id { "name": "New Name" }
DELETE /api/stories/:id
GET /api/testcases?project_id=1
GET /api/testcases?story_id=1
GET /api/testcases/:id
GET /api/testcases/:id/history
POST /api/testcases { "story_id": 1, "name": "test_login", "class_name": "tests.TestAuth", "key": "test_login" }
PUT /api/testcases/:id { "name": "...", "description": "...", "key": "..." }
DELETE /api/testcases/:id
GET /api/runs?project_id=1
GET /api/runs/:id
GET /api/runs/:id/results
GET /api/runs/:id/results?status=failed
GET /api/runs/:id/coverage
DELETE /api/runs/:id
POST /api/runs/upload { "project_id": "demo", "xml": "<testsuite>...</testsuite>" }
Accepts JUnit XML content. The server parses the XML and automatically matches results to existing test cases using a 3-tier strategy: first by key (pytest function name), then by class_name + name, then auto-creates from classname parsing.
GET /api/runs/:id/coverage
Returns the full test spec for the project merged with results from this run. Every active test case is included — those without a result in the run have null status/id fields. Unmatched results (not linked to any test case) are also appended. Used by the run detail page to show test coverage gaps.
cd packages/cli
npm run build
npm linkThis compiles the TypeScript source and makes the testops command available globally on your system.
# Single file
testops upload --project demo --file results.xml --url http://localhost:3001
# All XML files in a directory
testops upload --project demo --dir ./test-results --url http://localhost:3001TestOps maps test results to features, stories, and test cases. You can control this mapping by embedding properties in your JUnit XML output.
| Property | Description | Fallback |
|---|---|---|
feature |
Feature name | Derived from classname (second-to-last segment) |
story |
Story name | Derived from classname (last segment) |
test_case |
Human-readable test case name | Uses the function name from name attribute |
When test_case is provided, the function name (XML name attribute) is stored as the matching key, and the property value becomes the display name.
- Define custom pytest markers in
conftest.py:
import pytest
def pytest_configure(config):
config.addinivalue_line("markers", "feature(name): assign test to a feature")
config.addinivalue_line("markers", "story(name): assign test to a story")
config.addinivalue_line("markers", "test_case(name): human-readable test case name")
@pytest.hookimpl(tryfirst=True)
def pytest_runtest_makereport(item, call):
"""Inject feature/story/test_case markers as JUnit XML properties."""
if call.when == "call":
for marker_name in ("feature", "story", "test_case"):
marker = item.get_closest_marker(marker_name)
if marker and marker.args:
item.user_properties.append((marker_name, marker.args[0]))- Annotate your tests —
featureandstoryon the class,test_caseon each method:
import pytest
@pytest.mark.feature("Authentication")
@pytest.mark.story("Login")
class TestLogin:
@pytest.mark.test_case("Login with valid credentials")
def test_login_valid_credentials(self):
...
@pytest.mark.test_case("Login with invalid password")
def test_login_invalid_password(self):
...
@pytest.mark.feature("Authentication")
@pytest.mark.story("Registration")
class TestRegister:
@pytest.mark.test_case("Register a new user")
def test_register_new_user(self):
...- Run with JUnit XML output (use
xunit1so properties appear inside<testcase>):
pytest --junitxml=results.xml -o junit_family=xunit1This produces <properties> elements inside each <testcase>:
<testcase classname="tests.test_auth.TestLogin" name="test_login_valid_credentials">
<properties>
<property name="feature" value="Authentication"/>
<property name="story" value="Login"/>
<property name="test_case" value="Login with valid credentials"/>
</properties>
</testcase>When no feature/story properties are present, TestOps derives them from the classname attribute:
tests.test_auth.TestLogin→ feature=test_auth, story=TestLogin- Last segment = story, second-to-last = feature
When no test_case property is present, the function name (name attribute) is used as both the display name and the key.
- Create a project via the API or web UI
- Define features, stories, and test cases (set
keyon each test case to match pytest function names) - Run your tests with JUnit XML output (e.g.
pytest --junitxml=results.xml) - Upload results:
testops upload --project <slug> --file results.xml --url http://localhost:3001 - Browse results at
http://localhost:3001