Hi Darshan, Steps are basically the Sequences which can be used to describe how exactly the test scenario will take place. It also defines the preconditions of the test scenario. Some of the Keywords used by Steps are:
The commands which are mainly used in Steps of Cucumber Execution are:
-
Given - Before starting the tests, all of its conditions is described by this.
-
When - The actions during Cucumber tests are described by this.
-
Then - This is the outcome of the actions which took place When.
For eg, following example shows a Cucumber Steps Definition file:
Step 1:
Given (/^ I am on google.com$/) do
Browser.goto "http://google.com" -This will visit career.guru99 on browser
end
Step 2:
When (/^ click on I'm Feeling Lucky$/) do
Browser.text (:name, "btnI" ).click – This will click "I'm Feeling Lucky button"
end
Step 3:
Then (/^ I should see google doodles page$/) do
Browser.goto "http://google.com/doodles/" - It will visit "doodles page"
end