Simple Cucumber Script

Pre-Requisites:

Continue from the previous page where we wrote the Cucumber scenario

Steps:

 

1. Right Click on the step_definitions folder and New -> File

addition_step_def_file

 

2. Name the file as “addition.rb” (.rb stands for ruby extension)

 

addition_steps_rb

 

 

3. Copy paste the below code in the file “addition.rb”

 

 4. Now right-click on the Scenario in addition.feature and click Run

 

 

addition_feature_steps_run

 

5. The scenario should now pass as below

 

addition_feature_passed

 

Summary: As you can see Cucumber is a beautiful way of describing the behavior of application (in terms of scenarios) and making those scenarios executable using Automation code.

 

Now lets write our first Selenium script

First Cucumber Scenario Video