10/22/2011

Cucumber Terminology


Going to explain different Cucumber terms.

Feature File
Feature files are plain-text files & cucumber uses these files to validate some system functionality against its specifications. Feature files should have a “.feature” extension.
There can be any number of feature files for a single “Step-Definition”. Each feature should be illustrated with key examples. Everything written in the feature file is in the form of the Plain-text. Each feature consists of one or more “scenarios”. Every feature file has a single feature description at the top, but can have any number of Scenarios.


Scenarios
Scenarios should have the same lifecyle as our code. Group multiple steps in one. The steps written in scenario include:
 GIVEN ………….
 WHEN…………..
 THEN…………….
Step Definition in Ruby
In order to run feature file, the Ruby code is written in the “Scite” Editor & is saved in the form of “.rb” file & this file should be placed in a folder named as Step_definitions. It tells Cucumber what to do when interpreting a particular step. Once a step definition is implemented, the step can be reused in other scenarios.
CUCUMBER Tags
Tags are a great way to organise the features and scenarios. It is indicated by the“@” symbol. A Scenario or feature can have as many tags as we like. Any tag that exists on a Feature will be inherited by Scenario, Scenario Outline or Examples. We can use the --tags option to tell Cucumber that we only want to run features or scenarios that have (or don’t have) certain tags.

How to Run feature File
The code written in the step_definition file  runs on the command prompt (Go to Start menu>All Program>Rails Installer> select command prompt with ruby & rails).In the command  prompt write  the location of the main folder where “features” folder is placed & write “cucumber” in last.
After running the code the success steps will be indicated by “GREEN” colour & failed steps will be indicated by “RED” colour. “YELLOW” colour indicates undefined steps.

0 comments:

Post a Comment