Table of Contents
To write an embedded-system test case, turn one requirement into a repeatable procedure with exact preconditions, test data, steps and a measurable expected result, linked to that requirement.
It must also cover hardware behaviour – sensor input, timing and faults – and specify the board revision, firmware version and measurement method. The 1996 Ariane 5 failure, costing over US$370 million, shows the risk of missing such tests.
Key Takeaways
- Make each test case specific, repeatable, measurable and traceable to one requirement.
- Test software logic and hardware behaviour, including timing, interfaces and faults.
- Use equivalence classes and boundary values for test data.
- Write expected results as numbers, signals or logs – not “works properly”.
- Record firmware version, hardware revision and evidence for every run.
- Maintain a traceability matrix and automate regression tests.
Kickstart Your Embedded Systems Career and Turn Your Tech Passion into High-Demand Skills!
What is a Test Case in Embedded Systems?
A test case in an embedded system’s part of a documented procedure that checks a specific thing that’s supposed to work in a product. This could be whether the firmware, the hardware or the whole product actually does what the people designing it said it was supposed to do.
The international test-documentation standard – ISO/IEC/IEEE 29119-3 – basically lists the key bits that a test case needs to have:
- an identifier
- what it is trying to achieve
- its priority
- where it came from (so people can track it back to the original requirement)
- what you need to have in place before you start (the preconditions)
- what you put in
- what you expect to see
As the same code can behave differently on different boards or under different conditions – embedded teams tend to also add a bit about the environment the test was run in, and some sort of evidence to prove it was actually done.
Master Embedded Systems Programming!
Launch your tech career with our Embedded Systems Course, designed for hands-on learning and industry readiness.
Know MoreWhy do Embedded Test Cases Matter?
They catch problems with the hardware-software combo early on, stop new updates from breaking things that already work, and provide the evidence that regulators and customers want to see.
In industries where safety is a concern, testing your product to make sure it meets all the requirements it’s supposed to meet is just a basic expectation. And the more risk there is, the more careful and detailed your testing needs to be.
| Standard | Domain | What it expects from testing |
| ISO 26262 | Automotive | Requirements-based testing is highly recommended at every ASIL.Equivalence classes, boundary values and error guessing are named methods for deriving test cases.Fault injection is recommended more strongly at higher ASILs. |
| DO-178C | Airborne software | Requirements-based tests plus structural coverage by software level: statement (Level C), decision (Level B) and MC/DC (Level A). |
| IEC 62304 | Medical device software | Verification effort and documentation scale with safety class A, B or C. |
What Types of Test Cases do Embedded Systems Need?
A complete suite covers normal behaviour, limits, faults, timing and communication, moving from unit tests on drivers to integration, system and regression testing.
| Test type | Purpose | Example |
| Functional | Confirms a feature works as specified | Logging starts when the power button is pressed |
| Boundary | Tests values at and around thresholds | Alarm stays off at 60.0°C and turns on at 60.1°C |
| Negative/robustness | Checks invalid input or failure | Disconnected sensor puts the device in a safe state |
| Timing | Validates real-time response | Alarm output rises within 200 ms of a threshold breach |
| Interface | Verifies UART, SPI, I2C or CAN communication | MCU accepts valid CAN frames and rejects corrupted ones |
| Fault injection/safety | Confirms safe behaviour under faults | Motor stops when the emergency switch opens |
| Regression | Rechecks existing features after changes | Sensor accuracy is unchanged after a firmware update |
Where you run your tests also matters – logic that doesn’t interact with the hardware can be tested on a host PC. But timing, drivers and other things that need to work with the hardware properly need to be tested on the actual board or a hardware simulator.
What Should an Embedded Test Case Template Include?
An embedded test case template should cover things like a unique identifier, where the requirement came from, what you need to do to set things up, what you put in, what you do, what you expect to see, and some sort of proof that you actually ran the test.
Having a consistent layout lets you pick up on problems when they happen and lets anyone else run the same test months down the line.
| Field | What to include |
| Test case ID | Unique code, such as TC-TEMP-001 |
| Objective | One sentence stating what is verified |
| Requirement ID | The requirement covered, such as REQ-TEMP-003 |
| Type and priority | Boundary, timing or interface; critical to low |
| Preconditions | Board revision, firmware build, power state, connections, tools |
| Test data | Exact values, signals or commands |
| Steps | Numbered, one action each |
| Expected result | Measurable pass or fail criterion |
| Actual result and status | Observed outcome; pass, fail or blocked |
| Evidence | Serial log, logic-analyser or oscilloscope capture, test report |
Master Embedded Systems Programming!
Launch your tech career with our Embedded Systems Course, designed for hands-on learning and industry readiness.
Know MoreHow do You Write Test Cases for Embedded Systems?
Follow these seven steps, using one requirement as the running example: “REQ-TEMP-003: When the measured temperature exceeds 60°C, the system shall activate the alarm within 200 ms.”
1. Break the requirement into testable conditions
Identify the trigger, threshold, timing limit, output and error handling. Here that gives four conditions: alarm on above 60°C, alarm off at or below 60°C, response within 200 ms, and a safe response to a missing sensor.
2. Choose test data using equivalence classes and boundaries
Values in one class should behave alike, so test one representative plus the edges of each class.
| Input | Class | Expected behaviour |
| 25.0°C | Valid, below threshold | Alarm OFF |
| 60.0°C | Boundary (not “exceeds”) | Alarm OFF |
| 60.1°C | Boundary, just above | Alarm ON within 200 ms |
| 85.0°C | Valid, high | Alarm ON within 200 ms |
| Open-circuit sensor | Invalid | Fault flag set; safe state entered |
3. Define exact preconditions
Replace “set a high temperature” with “simulate a thermistor input of 61°C using a calibrated signal source, on board rev B, firmware v2.3.1”.
4. Write atomic steps
One action and one expected observation per step, so you know precisely where a failure occurred.
| Step | Action | Expected result |
| 1 | Power on with firmware v2.3.1 | Boots without errors; status LED turns green |
| 2 | Apply a 61°C simulated input | Debug console shows 61°C |
| 3 | Observe the alarm output | Alarm GPIO goes HIGH within 200 ms |
5. Make expected results measurable
“UART prints TEMP_ALERT: 61C and the alarm LED turns on within 200 ms” can be judged pass or fail; “system works properly” cannot.
6. Record results and evidence
Log the tester, date, firmware version, hardware configuration and captures such as serial logs, protocol traces or timing measurements.
7. Report defects, retest and run regression
Attach reproduction steps and logs to the defect, rerun the failed case after the fix, then rerun related tests to confirm nothing else broke.
Worked Example: Temperature Alarm Test Case
| Field | Details |
| Test case ID | TC-TEMP-001 |
| Title | Verify alarm activation when temperature exceeds 60°C |
| Requirement ID | REQ-TEMP-003 |
| Type / priority | Functional and timing / Critical |
| Preconditions | Board rev B powered; firmware v2.3.1 loaded; sensor input simulated; alarm LED and buzzer connected |
| Test data | Simulated temperature: 61°C |
| Steps | 1. Power on. 2. Wait for boot. 3. Apply 61°C input. 4. Capture alarm output and timestamp. |
| Expected result | LED on and buzzer sounding within 200 ms; UART prints TEMP_ALERT: 61C |
| Actual result / status | Recorded at execution; pass, fail or blocked |
| Evidence | Serial log, GPIO timing capture, test report |
What are the Best Practices and Common Mistakes?
Tests should be written from the requirements, not the other way round. That way you are checking that the product actually does what it is supposed to do, not just confirming that the code happens to work in a certain way.
- Also, keep each test case focused on a single objective so that when it fails you can quickly figure out what went wrong.
- Test the boundaries of what the product is supposed to do – and what happens when things go wrong – not just the ‘happy path’ where everything works perfectly.
- If you can separate the logic that deals with the hardware from the rest of the logic then you can test the logic part on a host PC.
- At the early stages use mock-ups for parts of the hardware so you can start testing early. Then when you have real hardware – test the timing, drivers and communication side of things.
- For safety projects – measure how much of the code you’ve actually tested.
- And don’t be vague about what you found, don’t leave out the firmware version, don’t have tests that aren’t properly tracked, and don’t skip the regression tests.
Kickstart Your Embedded Systems Career and Turn Your Tech Passion into High-Demand Skills!
Which Tools Support Embedded Testing?
| Tool or technique | Purpose |
| Debugger (JTAG/SWD) | Step through firmware, inspect memory, set breakpoints |
| Serial terminal | Capture UART logs and debug messages |
| Oscilloscope / logic analyser | Measure GPIO, PWM and timing |
| Protocol analyser | Validate UART, SPI, I2C, CAN or USB traffic |
| Unit-test frameworks (Unity, CppUTest, GoogleTest) | Test functions and modules, often with mocks |
| Automation frameworks (pytest, Robot Framework, NI TestStand) | Run repeatable suites and generate reports |
To get better at this, take a small project like a development board with a sensor and an actuator, write up the requirements, create some test cases that cover the boundaries and things that can go wrong, run them on a board and keep track of what you found so you can go back and see what worked and what didn’t.
Conclusion
Writing good embedded test cases is about taking each requirement and turning it into a clear, simple and repeatable check that the product does what it is supposed to do across all the different parts – the logic, the hardware interfaces, timing and all the different failure conditions.
If you stick to a consistent template, test the boundaries, keep track of what you found and automate the regression tests then you will have the evidence you need to show that the product works before it ships.
Master Embedded Systems Programming!
Launch your tech career with our Embedded Systems Course, designed for hands-on learning and industry readiness.
Know MoreFrequently Asked Questions
How is embedded testing different from software testing?
It must validate hardware interaction, real-time timing and fault behaviour as well as logic. Results can also change with board revision and power supply.
How many test cases should an embedded feature have?
There is no fixed number. Write enough to cover normal behaviour, boundaries, invalid inputs, faults, timing and regression.
What should an embedded test case template include?
Include an ID, objective, requirement ID, preconditions, test data, steps, expected result, actual result, status and evidence. Add firmware version and hardware revision.
Why is traceability important?
Traceability links requirements to test cases and results. It proves coverage and shows which tests to rerun when a requirement changes.
How do you test timing requirements?
Capture the stimulus and response with a logic analyser, oscilloscope or timestamped log. Compare the measured delay with the specified limit, such as 200 ms.
Can embedded test cases be automated?
Yes, unit, integration and regression tests can be scripted and run repeatedly. Hardware-dependent tests need a physical rig or hardware-in-the-loop setup.
How do you handle a failed test?
Log the defect with steps, logs, firmware version and hardware details. After the fix, rerun the failed test and related regression tests.
Which tools do embedded testers use?
Common choices are debuggers, serial terminals, logic analysers, unit-test frameworks like Unity or CppUTest, and Python automation. The mix depends on where the tests run.




