Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How Cucumber Works ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 382
    Comment on it

    Cucumber a command-line tool has scenario inside the Feature file which contains a list of steps for the Cucumber to work through. Cucumber follow some basic rules or syntax called Gherkin to understand these feature files.

     

    Since each scenario contains some step, so there should be a step definition with each step which map the business-readable language of each step into Ruby code to perform the desired action. Let's suppose, we have a feature file:

     

    Feature: Verify the Signin Functionality through Global Header

     @TC006 @sanity @signin @medium @positive @regression

     Scenario Outline: Signin through Global Header

        Given I am at Home Page

        And I clicked on SignIn link

        And I enter <Username> as username for SignIn

        And I enter <Password> as password for SignIn

        And I clicked Remember me checkbox

        And I clicked on SignIn button

        Then I should see the Activities page

        And This is the end of testcase

     

        Examples:

         | Username | Password |

         | testing  | testing  |


     

    Every feature file starts with a "Feature" keyword followed with optional tags. Each tag starts with "@" symbol. Tags are basically used to mark any scenario. Let's suppose in our testsuite we have 100 testcases in which 40 are sanity testcases, then we will put "@sanity" tag over the desired testcase(scenario). So, to run only sanity testcases we have to execute the following command from the project folder.

     

    cucumber --tags ~@sanity

     

    Now, only 40/100 sanity testcases will be executed.

    Here, "Given", "And" and "Then" are Gherkin keywords. Every teststep must starts with Gherkin keyword only. First, cucumber will search the step definition for "I am at Home Page" in the entire project and execute the desired action. After the execution of first step definition, cucumber will look for the next teststep in the feature file. Now, again search the step definition of second step; this process continues till all the steps in the scenario are executed.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: