Cucumber

How we use it in the scolaris projects

  • Quick reminder
    • What it's for
    • Syntax
  • How it's set up
    • cucumber-jvm
    • JUnit runner
    • Maven config
  • Example

What's it for?

  • BDD
  • Human readable
  • (Programming & Spoken) language agnostic

Syntax

  • Language called Gherkin
  • Stored in .feature files
Business Readable, Domain Specific Language that lets you describe software’s behaviour without detailing how that behaviour is implemented.

Syntax

Feature: Some terse yet descriptive text of what is desired
  In order to realize a named business value
  As an explicit system actor
  I want to gain some beneficial outcome which furthers the goal

  # This is a comment
  Scenario: Some determinable business situation
    Given some precondition
      And some other precondition
     When some action by the actor
      And some other action
      And yet another action
     Then some testable outcome is achieved
      And something else we can check happens too

  Scenario: A different situation
  ...

How it's set up

  • cucumber-jvm - Allows us to implement step definitions in java (or other JVM languages)
  • JUnit runner - Lets us run cucumbers as you would any other JUnit test
  • Maven setup - config in sipp2-parent, included in project frontends.

Lets write one!


          Feature: Personalisation. All the features of the site that require you to log in using your personal email address.
          
          Scenario: Log in
            Given my username is cuke@semantico.com
            And my password is cucumber
            When I sign in
            Then I should see that I am logged in as Cucumber
            And I should be able to log out again.
          

Actually… here's one I made earler.

The Future

  • TestNG runner
  • Continous deployment
  • Spread the cucumbers (specs, QA, monitoring)

Here is a kitten

The End