Home > On-Demand Archives > Talks >
Example of BDD Style TDD For Embedded System Software
Steve Branam - Watch Now - EOC 2024 - Duration: 47:11
Based on the blog post https://www.embeddedrelated.co
BDD adds several advantages to TDD:
- It results in an executable specification of a module that is understandable by both technical and non-technical stakeholders. This makes it easier to understand by all parties, and easier for them to specify additional behavior.
- Because of its emphasis on behavior, it guides the developer to test to interface, not internals. This minimizes the risk of creating brittle tests. That minimizes the need for test maintenance when doing production code maintenance: changing the internals doesn't create a mass of failing tests.
- It focuses on one aspect of behavior at a time. This ensures that tests only test one thing at a time, keeping them simple. When a test fails, it's clear what failed and what should have happened. That makes isolating and fixing the problem faster.
- It avoids code bloat and untested code, since every bit of production code is there because a behavioral test required it.
This additional layer of discipline makes TDD even more effective for both immediate development and long-term maintenance. It's easily applied to embedded systems modules to enable off-target testing, resulting in known-good components. It works equally as well when you start with a well-defined idea of what the module internals will be and when you only have a vague idea.
Hey Steve - Holy cow. There is an immense amount of useful information included there. I'm going to have to watch that 4-5 more times just to have a chance of digesting it all. :D I'm sure that took you an insane amount of time to put together. Thank you so much. Question: Would this be a decent restatement of what you're presenting or not? BDD is really a "best practices" for TDD in that you should be creating tests that describe what your code is supposed to be doing and not how? Because with TDD, you can really go off the rails with tests that focus on implementation and not function. (Reposted - see live Q&A for response).
I met a cow once, boy ... was she holy !! Her behaviour towards me really tested her but ... that's another story! Great slides with lots of useful nuggets!