What did I learn in about Cucumber and Gherkin <!–more–>

Introduction to Cucumber

  • Acceptance Test Driven Development
    • Defines tests which act as requirements to a system
    • Development focused
  • BDD
    • Describes overall behavior of the system
    • Customer focused
  • Gherkin - Plain language of describing a test case
    • Non techinical
    • Human Readable
    • Helps enforce firm, unambiguous requirements
    • Keywords
      • Given
      • And
      • When
      • And
      • And
      • Then
    • Cannot have multiple When following consecutively
    • Given precondition
    • When Action
    • Then Results
  • Cucumber is an open source tool for test automation
    • Used to write test cases in Gherkin format
    • Use Regular expressions to match Gherkin to code
    • Cucumber step is what wraps the automation code
    • Has been implemented in Ruby, Jruby
    • It was originally developed for Ruby
    • Tests are written in .feature file
      • Multiple scenarios
      • Each scenario will contain multiple steps
    • Each feature should be independent
    • Each scenario should be independent
  • Scenario outline is powerful - Loop full scenario for each row
  • header in the example table should match the variable defined in the step
  • Step table - data used all at once - No looping for a scenario
  • Gherkin backgrounds - convenient way to make tests shorter, readable
  • Multiple when should not be present in the file