Skip to main content

Writing Test Cases

Test cases are the foundation of TESTMETRIX. Well-written test cases make runs reproducible and results meaningful.

Creating a Test Case

  1. Open your project
  2. Navigate to Test CasesNew Test Case
  3. Fill in the form fields described below
  4. Click Save

Test Case Fields

Required Fields

FieldDescriptionExample
TitleShort, action-oriented nameVerify CAN message on startup
CategoryModule or functional areaCommunication, Safety
Expected ResultObservable outcome for passCAN frame 0x100 transmitted within 50ms

Optional Fields

FieldDescription
DescriptionBackground context and purpose of the test
PreconditionsRequired system state before execution
StepsNumbered, reproducible execution steps
PriorityHigh / Medium / Low
TagsFreeform labels for filtering
Linked RequirementRequirement 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"
}'