Big Pete Taylor
Big Pete Taylor

Reputation: 135

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?

Upvotes: 6

Views: 1645

Answers (5)

John Hyland
John Hyland

Reputation: 6872

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.

Upvotes: 10

Jonas Elfström
Jonas Elfström

Reputation: 31438

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

Upvotes: 3

Pascal Thivent
Pascal Thivent

Reputation: 570505

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).

Upvotes: 1

khelll
khelll

Reputation: 24010

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

Upvotes: 1

Nando Vieira
Nando Vieira

Reputation: 974

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.

Upvotes: 3

Related Questions