dimanche 1 mai 2016

RSpec and Cucumber in the RoR wild

I am learning RSpec and Cucumber, so that I can write tests for our Rails website at work.

While learning, I used a book called "The RSpec Book: BDD with RSpec, Cucumber and Friends". During this, RSpec was used for granular tests and Cucumber was used for overall usability tests.

The book used a simple CLI game as an example.

Now I am heading into a web environment, wondering what is the mentality of testing in a web environment.

I already know that I will be writing spec tests for my models and controllers.

I assume where Cucumber comes in is full feature tests which will use both controller and model to accomplish.

Please correct me if I'm wrong, but let's say there are User, Post and Likes models.

Each of these would have a model spec + however many controller specs.

Then I would write a single feature test as:

Feature: liking a post
  As a user of abc.com
  I want to like a post
  So that I can show my friends

Where I would log in as someone, find a post and like it?

Anyone with experience mind sharing the angle of approach on testing with these tools on a Rails application?

Let's say I had to implement the situation above, would you start by fleshing out the feature test, write the model specs, then write the controller specs and then write code?

Aucun commentaire:

Enregistrer un commentaire