Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the main difference between cucumber and shoulda?

How would you make a decision between cucumber and shoulda if you were about to choose a testing framework?

What differentiates these two frameworks primarily?

like image 548
Big Pete Taylor Avatar asked Sep 19 '09 16:09

Big Pete Taylor


5 Answers

As everybody has pointed out, Cucumber and Shoulda have fairly different objectives. You can think of Cucumber as being the "view from 10,000 feet" testing framework - you define a broad feature or specific user interaction and make sure everything works together. Shoulda is for unit testing - you pick out a specific model and thoroughly test all the picky little bits of functionality for that individual piece.

Usually, you would want to use these sort of frameworks in conjunction. For example, most of your broad, high level tests can be written in Cucumber, but when there's a particularly complex or opaque bit of code in your system, you can drill down with Shoulda or RSpec to test the particulars.

like image 91
John Hyland Avatar answered Nov 14 '22 13:11

John Hyland


They have completely different objectives. Shoulda is a unit testing extension built on top of Test::Unit.

Cucumber is a Acceptance/Functional Testing framework that can use Test::Unit/RSpec/Whatever for doing the assertions.

Shoulda can be directly compared to RSpec, for instance.

like image 26
Nando Vieira Avatar answered Nov 14 '22 13:11

Nando Vieira


I don't see anyone else mentioning that you actually can use Shoulda as the "test-engine" for Cucumber.

like image 45
Jonas Elfström Avatar answered Nov 14 '22 15:11

Jonas Elfström


Cucumber is targeting Acceptance Testing. Shoulda is a Unit Testing framework.

like image 1
khelll Avatar answered Nov 14 '22 15:11

khelll


Shoulda is an extension of the Test::Unit framework that consists of test macros, assertions, and helpers. Shoulda is a prettier way to write unit tests.

Cucumber - a rewrite of RSpec's "Story runner" - is a tool for Behaviour-Driven Development. It allows you to write executable specifications in a business-readable domain-specific language. Cucumber is more an acceptance testing tool.

Cucumber and Shoulda have thus different objective (even if Shoulda can be used for BDD).

like image 1
Pascal Thivent Avatar answered Nov 14 '22 13:11

Pascal Thivent