Cucumber

Introduction

Cucumber is a testing framework that helps to bridge the gap between QA and business managers. Tests are written in plain language terms using Gherkin so anyone in the team can understand even if they are not a technical person, with the help of feature files which we create to run the tests, also we can run multiple scenarios in one feature file. Cucumber interprets the tests into the specified programming language and using Selenium to drive the test cases in a browser. 

Installation / Dependencies

Cucumber Eclipse Feature need to be installed, to create Feature Stories:

Follow instructions:

Cucumber_2

Pro’s And Con’s

Setup With Examples

– Cucumber Structure

– Cucumber Framework 

         o Feature File

               ♣ Creating a Feature File

                       ♣ Right Click on your Feature Folder

   ♣ Under ‘File Name’ type in your Feature Name with .feature at the end

   ♣ Click on ‘Finish’ Button (A Feature File would be generated)

Notes:

                   ♣ Used to Execute Chosen Scenarios / Test Scripts

Notes:

             o Single Scenario – “@tag1”

             o Multiple Scenario – “@tag1, @tag2”

             o Execute all, but exclude this Scenario –  “~@tag3”

          o StepDefinition.Class

 ♣ Using the TestRunner.Class, execute it via the DryRun as True, this would generate the following:

♣ Copy these Scenario Methods from the Console and add them into your StepDefinition.Class 

♣ Add Code into each Method, to create a full Test

♣ For the drivers to be linked together with the Hook.Class & StepDefinition.Class, you need to add the following into the StepDefinition.Class (As the Webdriver gets initialised in the Hook.Class firstly, it needs to carry over to the StepDefinition.Class).

The CucumberReportStep.Class is below: 

         – Custom Extent Reporting

         ♣ I’ve added this within the TestRunner.Class along with the Config

    ♣ Config.xml (can be found on Extent Report Website)

Reference Sites

– https://cucumber.io/

– http://extentreports.relevantcodes.com/java/#configuration

– https://sukesh15.gitbooks.io/cucumber-jvm-test-framework-/content/write_your_first_test/decoding_the_feature_file.html

– http://toolsqa.wpengine.com/cucumber/gherkin-keywords/

– http://toolsqa.com/cucumber/cucumber-tutorial/

– https://github.com/email2vimalraj/CucumberExtentReporter

Latest content

Thanks for joining us! We’ll keep you informed with regular updates.

Sign up to our newsletter

Consent(Required)
This field is for validation purposes and should be left unchanged.