Cucumber Script 1: Multiply 2 Numbers Cucumber Script 2: Verify output when Email id is entered or not entered
Cucumber Script 1: Multiply 2 Numbers
Step 1) Open RubyMine Editor via windows start menu
Step 2) In Rubymine Editor, click on Create New Project
Step 3) Select the Project location and click “Create.”
Step 4) Create a file directory
Step 5) Name the directoryas “features”
Step 6) Create and Save File in “yourfolder/features/” with name “yourfilename.feature”
Step 7) To execute our scenario, save the following program in the Feature File
Code: Step 8) Now let’s Run our First feature file! Click on “Start Command Prompt With Ruby”
And the output you get is
You see the error because you have to write step definitions file for feature file Step 9) Let’s create step definition file for our Feature File! Create a new folder in Rubymine editor with name “step_definition”
Step 10) Save File As below in “yourfolder/features/step_ definitions” with name test_step.rb
Step 11) Write the following code into the step file
Code : Step 12) Now, again run our feature file:
The result is
Cucumber Script 2: Verify output when Email id is entered or not entered
In this example we use Ruby Test Scenario: Verify output when Email id is NOT entered Test Steps:
Open Browser Go To http://demo.guru99.com/ Do not enter Email id Click Submit
Test Scenario: Verify output when Email id is entered Test Steps:
Open Browser Go To http://demo.guru99.com/ Enter Email Id Click Submit
Code in Feature File Code in Step Definition File Run the code in command prompt and you get