Ruby On Rails Classroom image

prateek  darmwal / 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/  
 
 
 
image
prateek  darmwal

Skills    Ruby On Rails

Qualifications :- High School - S.K.M. Sn. Sec. School, Haldwani, College/University - Graphic Era Hill University, Bhimtal,
Location :-Dehradun,Dehradun,Uttarakhand,India
Description:- I like to explore new technologies. I have skills in ruby on rails, php5, cakephp, jquery, javascript, html/css, java, c & c++. I love coding
Explore
 

  Students (0)