jvm-bdd-quality-driven
DESCRIPTION
TRANSCRIPT
Amir Barylko - BDD MavenThought Inc.
AMIR BARYLKO
QUALITY DRIVENBEHAVIOUR DRIVEN
DEVELOPMENT
JVM UGJAN 2012
Tuesday, January 10, 2012
Amir Barylko - BDD MavenThought Inc.
WHO AM I?
• Architect
•Developer
•Mentor
• Great cook
• The one who’s entertaining you for the next hour!
Tuesday, January 10, 2012
Amir Barylko - BDD Training OCT ‘11 MavenThought Inc.
TESTINGUnit tests
TDDIntegration TestsAcceptance Tests
Tuesday, January 10, 2012
Amir Barylko - BDD Training OCT ‘11 MavenThought Inc.
UNIT TESTING
•Test for a class or method
•No dependencies
•Should use mocking
•Small
•Clear
Tuesday, January 10, 2012
Amir Barylko - BDD Training OCT ‘11 MavenThought Inc.
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
Tuesday, January 10, 2012
Amir Barylko - BDD Training OCT ‘11 MavenThought Inc.
BENEFITS OF TDD
•Prove that your code works
•Avoid waste (debugging)
• Increment code quality
•Better design
•Regression tests as byproduct
•Make changes with confidence
•Bring back the joy of coding!
Tuesday, January 10, 2012
Amir Barylko - BDD Training OCT ‘11 MavenThought Inc.
WHEN TDD IS NOT ENOUGH
•Legacy Code
•Refactoring is not viable
•Verify functionality across layers
•Validate feature end to end
Tuesday, January 10, 2012
Amir Barylko - BDD Training OCT ‘11 MavenThought Inc.
INTEGRATION TEST
•More than one class
•Still some parts can be mocked
•Partial functionality of subsystem
Tuesday, January 10, 2012
Amir Barylko - BDD Training OCT ‘11 MavenThought Inc.
ACCEPTANCE TEST
•Black box testing
•Crossing all layers
•Should cover all scenarios
•External subsystems may be mocked
Tuesday, January 10, 2012
Amir Barylko - BDD MavenThought Inc.
SOFTWARE QUALITYWhat is it?
Low QualityClassic QA
Tuesday, January 10, 2012
Amir Barylko - BDD MavenThought Inc.
WHAT DOES IT MEAN?
•Better code?
•Faster delivery?
•Less bugs?
•Make sure we deliver the right thing?
•Better Processes?
Tuesday, January 10, 2012
Amir Barylko - BDD MavenThought Inc.
LOW QUALITY
• Lack of testing
• Lack of communication
• Lack of metrics
• Lack of traceability
•Wrong tools
Tuesday, January 10, 2012
Amir Barylko - BDD MavenThought Inc.
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)
Tuesday, January 10, 2012
Amir Barylko - BDD MavenThought Inc.
DOES IT WORK?
•Your opinion here......
Tuesday, January 10, 2012
Amir Barylko - BDD MavenThought Inc.
A NEW CONCEPTFeature First
BenefitsOutside In Approach
Runnable featuresRoles
Tuesday, January 10, 2012
Amir Barylko - BDD MavenThought Inc.
FEATURE FIRST
•Write the feature before implementation
•Developers will implement feature using TDD
•QA will validate against feature
•Repeat until all features are done
Tuesday, January 10, 2012
Amir Barylko - BDD MavenThought Inc.
BENEFITS
•Focus on the feature
•Testing all the way
•Traceability
•Quality every step of the process
Tuesday, January 10, 2012
Amir Barylko - BDD MavenThought Inc.
OUTSIDE IN APPROACHRed
GreenRefactor
BDD
TDD
Red
GreenRefactor
Tuesday, January 10, 2012
Amir Barylko - BDD MavenThought Inc.
RUNNABLE FEATURES
•Features describe functionality
•What if we could run them?
•Then features would validate functionality
•Becoming live documentation
Tuesday, January 10, 2012
Amir Barylko - BDD MavenThought Inc.
ROLES
•Who writes the feature?
•Who implements the feature?
•Who validates the feature?
•What’s the role of QA, PM, etc?
Tuesday, January 10, 2012
Amir Barylko - BDD MavenThought Inc.
WRITING FEATURESGherkinSyntaxFeatureScenario
Steps
Tuesday, January 10, 2012
Amir Barylko - BDD MavenThought Inc.
GHERKIN DSL
• Business readable DSL
• Flush out requirements
•Documentation
• Automated testing
• Used by Cucumber, SpecFlow, jBehave
Tuesday, January 10, 2012
Amir Barylko - BDD MavenThought Inc.
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
Tuesday, January 10, 2012
Amir Barylko - BDD MavenThought Inc.
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
Tuesday, January 10, 2012
Amir Barylko - BDD MavenThought Inc.
SCENARIOS
•Each feature file can have multiple scenarios
•Each scenario can contain multiple steps
•Keywords:
•Given When Then
•And Not But
Tuesday, January 10, 2012
Amir Barylko - BDD MavenThought Inc.
STEPS
Scenario: Browse available movies
Given I have some movies
When I go to the listing page
Then I should see all the movies
Tuesday, January 10, 2012
Amir Barylko - BDD MavenThought Inc.
TOOLSjBehaveScalatest
Cucumber + CapybarajDave
Tuesday, January 10, 2012
Amir Barylko - BDD MavenThought Inc.
JBEHAVE
Tuesday, January 10, 2012
Amir Barylko - BDD MavenThought Inc.
SCALATEST
Tuesday, January 10, 2012
Amir Barylko - BDD MavenThought Inc.
CUCUMBER
Tuesday, January 10, 2012
Amir Barylko - BDD MavenThought Inc.
BDD DEMO
Tuesday, January 10, 2012
Amir Barylko - BDD MavenThought Inc.
QUESTIONS?
Tuesday, January 10, 2012
Amir Barylko - BDD MavenThought Inc.
RESOURCES
• Contact me: [email protected], @abarylko
•Download: http://www.orthocoders.com/presentations
Tuesday, January 10, 2012
Amir Barylko - BDD MavenThought Inc.
RESOURCES II
• jBehave: http://jbehave.org
• Cucumber: http://cukes.info
• ScalaTest: http://scalatest.org
• Selenium: http://seleniumhq.org
• jDave: http://jdave.org
• EasyB: http://easyb.org
Tuesday, January 10, 2012