Cucumber
Cucumber
Implementatio
Software under test
n
Implementatio
n
Testing
Agile Software Development
Deploy Deploy
Analyz
Deploy Plan
Desig
e
n
Test Where Agile Fall Short
Build
Testing still follows traditional model
Testing happens in the
end
Deploy
Deploy
Where Agile Fall Short
Tech debt
Where Agile Fall Short
Lack of collaboration
Where Agile Fall Short
Commit
Commit
Where Agile Fall Short
Bad automation
Where Agile Fall Short
Test Driven Development
Write a testTest
Code
Refactor
that fails Write just enough
code to make
the test pass
Test
Code
Refactor public class CustomerTest {
@Test
public void
testSearchCustomer(){}
}
Test Driven Development
Test
Code
Refactor public class CustomerTest {
@Test
public void testFindCustomerByfirstName(){}
@Test
public void
testFailsForCustomerWithAnEmptyfirstName(){}
}
Test Driven Development
Test
Code
Refactor Customer lookup,
- Find customer by first name
- Fails for customer with an empty
first name
Test Driven Development
• Consistent vocabulary
• Eliminate ambiguity
• Eliminate miscommunication
Behavior Driven Development
What is BDD?
• Collaboration
• Build shared understanding
• Fast feedback
• Produce system documentation
BDD, TDD and Agile
Agile
principles:
Collaboration through face-to-face conversations
[#6]
Ubiquitous language
What is BDD?
Acceptance Criteria
Acceptance
Criteria
What is BDD?
Executable specifications
What is BDD?
Living Documentation
What is BDD?
Write a failing
scenario
Refactor
Discover Code
Code Write a failing
BDD Unit test
User
Story
TDD
Analyz
Deploy Plan
BDD, TDD and Agile
Formu
e
Test
late
Day Code
Discov
Refact
er
Day n
or
1 …
Deploy Deploy
User
Story
Example Mapping
User
Story
Example
Example Mapping
Thumb rules:
• Story with too many questions => more research nee
• Story with too many rules => break into new story
• Rule with too many examples => multiple rules need
• Rule with no example
• Story that cannot be scoped in one session
• Avoid Gherkins
Example Mapping
Quoting Matt Wynne:
The real benefit of example mapping is to be able to focus on the smallest pieces of
behavior inside your story, find the core of the behavior you want and defer the rest
until later. With this level of scrutiny, example mapping acts like a filter, preventing big
fat stories from getting into your sprint and exploding with last minute surprises three
days before demo-day.
BDD Myths
• IDE [IntelliJ/Eclipse]
• Plugins