What testing methods can I work with? [Rails]

Today I am launching a new project for a client.

I have already done some rail projects, but have never bothered writing tests for them. I would like to change this starting with this new project. I know there are several testing tools, but I'm a little confused about what I should use.

I heard about RSpec, Mocha, Webrat and Cucumber. Please keep in mind that I have never written any regular tests, so my knowledge of testing is generally quite limited.

How would you advise me to start?

Thank!


Thanks for all the answers! I posted a related question that might be of interest to those considering this issue in the future. You can find it here .

+5
source share
3 answers

I prefer to use Rspec and Cucumber together. I also prefer Capybara over Webrat.

RSpec is great for integration and rail structure. This is technically a behavior test, but in practice it experiences a sense of unit testing. It also allows you to group and define “specifications” or rspec tests in any structure you like, with “describe” blocks.

Cucumber is a higher level. This is what you translate into your user stories. For example, you may decide that your users should be able to change their password, so you will write something like this:

 Scenario: Change password
    Given I am logged in
    And I am on the change password page
    When I fill in "p4ssw0rd" for "old_password"
    And I fill in "newp4ssw0rd$$" for "new_password"
    Then my password should be "newp4ssw0rd$$"

QA, , . , , , .

+4

, , .

  • RSpec . Unit Testing , .

  • WebRat , . , /.

  • , . , - .

, . , Cucumber , WebRat Rspec. , .

+1

You can find the most popular testing platforms here http://ruby-toolbox.com/

Greetings

+1
source

All Articles