The document appears to be a presentation on quality driven development and behavior driven development. It discusses testing strategies like unit testing, TDD, integration testing and acceptance testing. It also covers benefits of techniques like TDD, limitations of classic QA approaches, and introduces concepts like feature-first development, outside-in testing, and using a language like Gherkin to define testable features and scenarios. Tools mentioned include jBehave, Scalatest, Cucumber and Capybara.
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Jvm-bdd-quality-driven
1. AMIR BARYLKO
QUALITY DRIVEN
BEHAVIOUR DRIVEN
DEVELOPMENT
JVM UG
JAN 2012
Amir Barylko - BDD MavenThought Inc.
Tuesday, January 10, 2012
2. WHO AM I?
• Architect
• Developer
• Mentor
• Great cook
• The one who’s entertaining you for the next hour!
Amir Barylko - BDD MavenThought Inc.
Tuesday, January 10, 2012
3. TESTING
Unit tests
TDD
Integration Tests
Acceptance Tests
Amir Barylko - BDD Training OCT ‘11 MavenThought Inc.
Tuesday, January 10, 2012
4. UNIT TESTING
• Test for a class or method
• No dependencies
• Should use mocking
• Small
• Clear
Amir Barylko - BDD Training OCT ‘11 MavenThought Inc.
Tuesday, January 10, 2012
5. TDD
• First write a test that fails (RED)
• Write code to make it pass (GREEN)
• Check if code can be improved (REFACTOR)
• Start again until it’s done
Amir Barylko - BDD Training OCT ‘11 MavenThought Inc.
Tuesday, January 10, 2012
6. BENEFITS OF TDD
• Prove that your code • Regression tests as
works byproduct
• Avoid waste • Makechanges with
(debugging) confidence
• Increment code quality • Bring
back the joy of
coding!
• Better design
Amir Barylko - BDD Training OCT ‘11 MavenThought Inc.
Tuesday, January 10, 2012
7. WHEN TDD IS NOT ENOUGH
•Legacy Code
•Refactoring is not viable
•Verify functionality across layers
•Validate feature end to end
Amir Barylko - BDD Training OCT ‘11 MavenThought Inc.
Tuesday, January 10, 2012
8. INTEGRATION TEST
•More than one class
•Still some parts can be mocked
•Partial functionality of subsystem
Amir Barylko - BDD Training OCT ‘11 MavenThought Inc.
Tuesday, January 10, 2012
9. ACCEPTANCE TEST
•Black box testing
•Crossing all layers
•Should cover all scenarios
•External subsystems may be mocked
Amir Barylko - BDD Training OCT ‘11 MavenThought Inc.
Tuesday, January 10, 2012
10. SOFTWARE QUALITY
What is it?
Low Quality
Classic QA
Amir Barylko - BDD MavenThought Inc.
Tuesday, January 10, 2012
11. WHAT DOES IT MEAN?
• Better code?
• Faster delivery?
• Less bugs?
• Make sure we deliver the right thing?
• Better Processes?
Amir Barylko - BDD MavenThought Inc.
Tuesday, January 10, 2012
12. LOW QUALITY
• Lack of testing
• Lack of communication
• Lack of metrics
• Lack of traceability
• Wrong tools
Amir Barylko - BDD MavenThought Inc.
Tuesday, January 10, 2012
13. CLASSIC QA
• Team separated from developments
• Follow scripts or requirements
• Done after the feature is implemented
• May have more than one project in the queue
• Feedback cycle may take weeks
• Manual (no automation)
Amir Barylko - BDD MavenThought Inc.
Tuesday, January 10, 2012
14. DOES IT WORK?
•Your opinion here......
Amir Barylko - BDD MavenThought Inc.
Tuesday, January 10, 2012
15. A NEW CONCEPT
Feature First
Benefits
Outside In Approach
Runnable features
Roles
Amir Barylko - BDD MavenThought Inc.
Tuesday, January 10, 2012
16. FEATURE FIRST
• Write the feature before implementation
• Developers will implement feature using TDD
• QA will validate against feature
• Repeat until all features are done
Amir Barylko - BDD MavenThought Inc.
Tuesday, January 10, 2012
17. BENEFITS
• Focus on the feature
• Testing all the way
• Traceability
• Quality every step of the process
Amir Barylko - BDD MavenThought Inc.
Tuesday, January 10, 2012
18. OUTSIDE IN APPROACH
Red
BDD
Red
Refactor Refactor TDD Green Green
Amir Barylko - BDD MavenThought Inc.
Tuesday, January 10, 2012
19. RUNNABLE FEATURES
• Features describe functionality
• What if we could run them?
• Then features would validate functionality
• Becoming live documentation
Amir Barylko - BDD MavenThought Inc.
Tuesday, January 10, 2012
20. ROLES
• Who writes the feature?
• Who implements the feature?
• Who validates the feature?
• What’s the role of QA, PM, etc?
Amir Barylko - BDD MavenThought Inc.
Tuesday, January 10, 2012
21. WRITING FEATURES
Gherkin
Syntax
Feature
Scenario
Steps
Amir Barylko - BDD MavenThought Inc.
Tuesday, January 10, 2012
22. GHERKIN DSL
• Business readable DSL
• Flush out requirements
• Documentation
• Automated testing
• Used by Cucumber, SpecFlow,
jBehave
Amir Barylko - BDD MavenThought Inc.
Tuesday, January 10, 2012
23. SYNTAX
Feature: Listing movies
As a User
I want to list movies
So I can see the contents of the library
Scenario: Browse available movies
Given I have the following movies
When I go to "Movies"
Then I should see in the listing
Amir Barylko - BDD MavenThought Inc.
Tuesday, January 10, 2012
24. FEATURES
• Keyword Feature
• The rest is free text
Feature: Listing movies
As a User
I want to list movies
So I can see the contents of the library
Amir Barylko - BDD MavenThought Inc.
Tuesday, January 10, 2012
25. SCENARIOS
• Each feature file can have multiple scenarios
• Each scenario can contain multiple steps
• Keywords:
• Given When Then
• And Not But
Amir Barylko - BDD MavenThought Inc.
Tuesday, January 10, 2012
26. STEPS
Scenario: Browse available movies
Given I have some movies
When I go to the listing page
Then I should see all the movies
Amir Barylko - BDD MavenThought Inc.
Tuesday, January 10, 2012
27. TOOLS
jBehave
Scalatest
Cucumber + Capybara
jDave
Amir Barylko - BDD MavenThought Inc.
Tuesday, January 10, 2012