Ruby On Rails Classroom image

Neha  Jaggi / Professional / Web Technology

To post your Question Join Classroom
Lesson Topics's No:-  |1 | 2 | 3|Last
Lessons:-Features and Steps

Features and Steps

Cucumber features are descriptions of expected behavior using a plain-text language called Gherkin. Gherkin tests read much like well-written RSpec examples, but because they are plain-text they are more accessible to those more comfortable reading English than Ruby code.

        OurCucumberfeatureswill implement a subset of thesignin examplesin Listing 8.5 and Listing 8.6. To get started, we’ll create a file in the features/ directory called signing_in.feature.

                Cucumber features start with a short description of the feature, as follows:

Feature:  Signing in


  Then they add individual scenarios. For example, to test unsuccessful signin, we could write the following scenario:

Scenario:   Unsuccessful signin
Given       a user visits the signin page
When      he submits invalid signin information
Then      he should see an error message


Similarly, to test successful signin, we could add this:

Scenario:   Successful  signin
Given       a user visits the signin page
And          the user has an account
And         the user submits valid signin information
Then       he should see his profile page
And        he should see a signout link 


Collecting these together yields the Cucumber feature file shown in Listing 8.32.


To run the features, we use the cucumber executable:

$  bundle  exec  cucumber  features/  

Compare this to

bundle exec rspec spec/  
Neha  Jaggi

Skills    Ruby On Rails

Qualifications :- High School - , College/University - Graphic Era Hill University, Dehradun, College/University - ,
Location :-Dehradun,Dehradun,UTTARAKHAND,India

Experienced Software Developer with a demonstrated history of working in the Information Technology and services industry. Skilled in Web Technologies (Ruby on Rails, PostgreSQL, php, Laravel and AJAX). 


  Students (0)