Saturday, April 22, 2023

 

How to write test case steps in cucumber


Below are some important keywords which are used to write test step in feature file.

Given: -
“Given” talk about precondition.

When: -
“When” talk about action. So whichever action user want to perform can be mentioned in When keyword.

Then: -
Then talk about result of that action. Expected behavior should be mentioned here which is expected after taking action.

And or *: -
“And” keyword talk about condition which will connect two steps.

But: -
But is used for writing negative steps in the scenario.

Step in Feature file

Feature: This is my first feature

Background:
Given Launch the website

@test
Scenario Outline: I want to launch shoping url

Given user logged in to website

When click on home page link

Then user should navigate to home page

But user able to see the large text:
"""
Below are the list of items which can be selected
user can select any value
"""

* the list are given below:
|Laptop|
|Kitchen|
|home_Appliances|

And user click on check box "yes"

Related Posts:

  • BDD cucumber Secondary keywords in feature file BDD cucumber Secondary keywords in feature fileSecondary keywords in feature fileBelow are some lists of secondary keywords which can be use in feature file while writing test case.1. # (hash sign): -hash(#) is used to … Read More
  • Regular expression in step definition in cucumber Regular expression in step definitionBelow are some lists of special character that can be used while writing step definition.1. .(dot)-We can use any character in place of "." In below example, single step definit… Read More
  • How to pass the Parameter in BDD cucumber? How to pass the Parameter?Passing parameter by using “” (double quotes) OR <> signFrom feature file, we can pass a single parameter by using “” in the step.Example is given below.Step in Feature file Given user lo… Read More
  • What Is Hooks In Cucumber? What Is Hooks In Cucumber?Hooks is nothing but the script which run before or after each scenarios. There are some annotation which are used to execute script before or after each scenarioes.Below are the lists of cucum… Read More
  • How to write step definition in cucumber? How to write step definition in cucumber?Java class is used for writing step definition file. This execute each given steps in feature file. We have to write a method for each step in step definition java class with sam… Read More

0 comments:

Post a Comment

Translate

Popular Posts

Total Pageviews

152,305