Writing Test Cases
Test cases are the foundation of TESTMETRIX. Well-written test cases make runs reproducible and results meaningful.
Creating a Test Case
- Open your project
- Navigate to Test Cases → New Test Case
- Fill in the form fields described below
- Click Save
Test Case Fields
Required Fields
| Field | Description | Example |
|---|---|---|
| Title | Short, action-oriented name | Verify CAN message on startup |
| Category | Module or functional area | Communication, Safety |
| Expected Result | Observable outcome for pass | CAN frame 0x100 transmitted within 50ms |
Optional Fields
| Field | Description |
|---|---|
| Description | Background context and purpose of the test |
| Preconditions | Required system state before execution |
| Steps | Numbered, reproducible execution steps |
| Priority | High / Medium / Low |
| Tags | Freeform labels for filtering |
| Linked Requirement | Requirement ID from your spec document |
Writing Good Test Cases
Be specific about the expected result. Instead of:
✗ "The system should work correctly"
Write:
✓ "LED D3 blinks at 2 Hz within 100ms of powering up the board"
One test case = one thing to verify. Split complex scenarios into multiple test cases. This makes it clear exactly which behavior failed.
Include hardware preconditions. Embedded tests often depend on hardware state:
Preconditions:
- Board powered via bench supply at 12V ±0.5V
- CAN bus connected to PC with PEAK USB-CAN adapter
- DUT firmware version ≥ 2.1.0 flashed
Importing Test Cases via API
For bulk creation, use the API:
curl -X POST https://testmetrix.de/api/test-cases/ \
-H "Authorization: Token YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"project": 1,
"title": "Verify watchdog reset on timeout",
"category": "Safety",
"expected_result": "MCU resets within 2s of timeout event"
}'