-
Challenge for TDD Embedded is:
-
Without a standard C libraries which always ready on build x86 machines
-
HW dependency
-
This may be a fake issue, HW dependency is another face as other sw module dependency
-
Tackling this with mock object
-
-
Whether target unit test required
-
99% is not necessary, since the logic is not different for different platform
-
1% for different logic is a good choice for adding target unit test
-
-
No target unit test framework
-
Choose or add one.
- A simple test loop for the changed 1% may be a good starting point
-
-
-
For embedded development the TDD phases will be a little changed since Dual-Target is a must
A standard TDD state machine should be something like following:
A dual-target TDD state machine should be something like this
code structure:
Some thinking on tackling with each challenge
-
Without a standard C libraries which always ready on build x86 machines
-
usually a bare metal platform will have a standard C library, or a de-factor C library having most of the api and class
-
some could be replaced with a simple substitution. e.g. malloc could be used with static arrays which has defined size on compiling
-
-
No other option, mock. May be simulation is another option depends on the readiness for simulation platform itself
-
write done the remain 10% unit test cases for those difference between 2 targets
-
Use the real logic to test the 10%, it seems not a big effort since the remaining logic has been verified.