2.7. Something Different¶
What if we could do something different?
Specify & write tests – But not tightly coupled with the APIs.
Specify what you want to happen, not how. You may ask what is the difference between What and How?
Maps to specification
Maps to implementation
Whatever tests we specify now, should be executable.
So Test Specification is more or less equal to Test Implementation.
So avoid Test Implementation stage after the review of Test Specifications.
2.8. Given, When, Then¶
Generally speaking, almost all our tests can be specified under these three keywords:
Given → When → Then
Some existing pre-condition.
Some action happens.
Then there is a re-action / effect.
And, that’s the key to BDD.
All tests in BDD are defined using these keywords. These are called scenarios in BDD.