Test Driven Development (TDD)
TDD is a Software Development methodology in which first test cases are written in the form of stories and then allowed to fail. After that the developers write code to pass the test cases thus implementing the story or requirement.
Cucumber is an automation tool used for automating acceptance tests that are written in BDD(Behaviour driven development) style, in the form of features. In cucumber we have two types of files – a feature file and a step definition file.
Feature file– A feature file defines some behaviour of the application in plain text. It can be written by QA, Business Analyst, client or even any non-technical stake holder. Feature files in cucumber are written in Given-When-Then form. Sample Feature file-
Feature: Check addition in Google calculator In order to verify that google calculator work correctly As a user of google I should be able to get correct addition result Scenario: Addition Given I open google.com When I enter 2+2 in search textbox Then I should get result as 4
Step Definition file – In a step definition file, we write the code that implements the steps written in Given-When-Then statements of the feature file. For implementing the steps we can use different tools and languages e.g. Watir with Ruby or Selenium with Java etc.
In the next post, we will set up cucumber with selenium in Java – Cucumber with Selenium and write a sample test script that will implement the google calculator feature file.