2. • Behavior-driven development (BDD)
• Originally a Ruby project
• Cucumber-jvm for Java projects
• Language called Gherkin
• Natural-language specification
3. • Alternative to TDD
• Response to issues with TDD:
– Where to start in process?
– What to test and what not to test?
– How much to test at once
– What to call the tests
– Understand why a test fails
• Specifies the *behavior* of your unit.
4. • PM/BA write cucumber features
– Test first!
– Easy when test == spec
• Developers write step definitions
5. • Feature – Single file, ideally describing a
single feature
• Scenario – A test case
• Given-When-Then: Test preconditions,
execution, and postconditions
• And, But – Additional test constructs
6.
7.
8.
9.
10. • Doesn’t need to be frontend-based
• Can use TestNG, JUnit, etc.
• You write all the step details
• Compose steps for more powerful
statements
11. • Does it even need an introduction?
• Browser driver for acceptance tests
• Requires a real browser
12.
13.
14. • Selenium WebDriver requires a browser
• Your CI server probably doesn’t have
Chrome or Firefox installed
– Or even a GUI…
• How can we run these tests without setting
up a remote runner or selenium grid?
15. • PhantomJS to the rescue!
• Headless WebKit browser
• Scriptable through JavaScript
• Now a PhantomJS Driver in WebDriver
16.
17.
18. • We’ve offered 4 PMs as sacrifice to the
demo gods…
• Project available on the dev9 GitHub
– https://github.com/dev9com/cucumber-java-selenium-example
19. • Textual language description of tests
• As frontend-driven acceptance tests
– Written by PM/BA…?
• Running on every commit on our CI server
20. • PhantomJS cannot test browser quirks
– Use a separate test suite just for browser-specific
testing. Manual, or with BrowserStack.
– Usually <10% of issues need specific browser
testing
• Textual language may give people a false
sense of security
– Only as strong as the step definitions