MISRA Discussion Forums

Full Version: 8.7 and design for testatbility
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
It seems that the 8.7 rule contradict design for testability.
Infact when you have a static variabile defined at block level, right now you have no way to perform any white box testing withot changing/adding code to copy the value to a global variable.

Let me know

Giacomo
Apologies for the long delay in replying to this question - it managed to go unnoticed.

Yes, Rule 8.7 does make it impossible to conduct white box testing without either adding code such as you suggest or using other devious means such as finding the address of the block-scope static, e.g. from a linker map file, and modifying is by means of a pointer. Neither approach is very satisfactory.

If you need to conduct white box testing then you would have good grounds for deviating from this rule.

Note: the equivalent rule in the recently-released MISRA C:2012 is advisory rather than required; it recognises the need to perform unit testing as being good grounds for not following the rule.