Cucumber Introduction
Cucumber Introduction
Cucumber Basics
In order to understand cucumber, we need to know all the
features of cucumber and its usage.
For instance: Feature files related to smoke test need not run all
the time. So if you mention a tag as smokeless in each feature
file which is related to smoke test and runs cucumber test with
@SmokeTest tag. Cucumber will run only those feature files
specific to given tags. Please follow the below example. You can
specify multiple tags in one feature file.
Example of use of single tags:
@SmokeTest
Feature: Login Functionality Feature
In order to ensure Login Functionality works,
I want to run the cucumber test to verify it is working
@positiveScenario
Scenario: Login Functionality
Given user navigates to PRIMUS
When user logs in using Username as “USER” and Password
“PASSWORD”
Then login should be successful
@negaviveScenario
Scenario: Login Functionality
Given user navigates to PRIMUS
When user logs in using Username as “USER1” and Password
“PASSWORD1”
Then error message should throw
#6) JUnit Runner:
To run the specific feature file cucumber uses standard JUnit
Runner and specify tags in @Cucumber. Options. Multiple tags
can be given by using comma separate. Here you can specify the
path of the report and type of report you want to generate.
import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;
@RunWith(Cucumber.class)
@Cucumber.Options(format={"SimpleHtmlReport:report/
smokeTest.html"},tags={"@smokeTest",”@LoginTest”})
Public class JUnitRunner {
}
7) Cucumber Report:
Cucumber generates its own HTML format. However, better
reporting can be done using Jenkins or bamboo tool. Details of
reporting are covered in next topic of cucumber.