10

I am having a concept problem at this point & I can't find any info about the differences between Test (UnitTest, etc) vs Spec (Rspec, etc).

As far as I know, specs is into Integration tests and test is into UnitTest but just that.

Can you explain what the differences are?

12

Look at the following diagram. It illustrates the relationship between Test-Driven Development (TDD) and Acceptance Test-Driven Development (ATDD):

Acceptance Test-Driven Development diagram

Notice that the inner loop, TDD, is enveloped by the outer loop, ATDD. Requirements (illustrated by the Acceptance Criteria box) drive the creation of automated acceptance tests, which in turn drive the creation of Unit Tests for implementation.

In general, RSpec would be used in those situations where you want to express tests in a Business Analyst-friendly way, namely the creation of automated acceptance tests (the tan circle); whereas Unit Test frameworks like nUnit are more specialized for the sort of unit tests written from the developer's TDD perspective at the implementation level (the yellow circle).

  • A good example is a hash table, this need detailed unit tests, as it is expect to work for all possible inputs, not just the small set of examples in the acceptance tests. However the code that calculates the discount for a “good” customer, is likely to be covered well by the acceptance tests, so may need no or few unit tests. – Ian Jun 29 '16 at 14:03
3

ok we have some different terms here, so here's what's going on

  • We have Unit Testing. Other levels are integration testing, performance testing, etc.
  • rspec can be used for many of the above levels of testing, e.g. against models, controllers and views through Capybara features tests.
  • the word 'spec' comes from specification which is at the heart of a test - it specifies something.
  • rspec - a framework used for testing agaist browsers, frequently used with Ruby on Rails applications.
  • spec files - rspec file usually end in _spec.rb and are frequently called spec files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.