BDD

Software development patterns | adopt

Behavior-Driven Development, or BDD, is a methodology that is built upon Test-Driven Development, TDD. Just like TDD, BDD is a test-first approach to software development, where the test needs to be written before any implementation takes place. This ensures that there is a high test coverage, and drives developers to write testable well-structured code. However, TDD focuses on testing individual units, while BDD focuses on the system behavior as a whole, usually on a higher level.

Test cases in BDD are written in a human-readable format, where every scenario contains three main steps: Given, When, and Then. "Given" sets the system under test in a required state, "When" denotes an action, and "Then" clause lists all the assertions. This strict format allows ease of understanding for both technical and non-technical people, and a case scenario like this serves the additional function of live documentation. BDD promotes communication within a team and aims at getting a deeper understanding of the domain.

We believe that such approach, even though it adds development overhead at first, is a great way to organically grow the test coverage, write quality code, and ensure the domain knowledge within a team, and we definitely recommend considering it.

adopt

Software development patterns