Alex Rivera | Logout

Why is cucumber considered an integration testing tool instead of a unit testing tool?

Asked 2010-11-17T05:40:50.173
17

This has always bothered me. Why is it people say to unit test in rspec but integration test in cucumber? I am not asking why these tests are necessary - I know what the difference is between integration and unit testing. I just don't see why, given cucumber's completely customizable syntax, it isn't used for unit testing?

It seems to me like the same amount of code is written for cucumber and rspec, the only difference is that for cucumber you separate the test logic from the test writing.

Edit
Report

1 Answer

1

The general idea is that Cucumber tests are written at a higher level than traditional unit tests. For instance when you unit test a particular module you're focused on testing only that modules functionality in isolation away from the rest of the system. The interface into other parts of the system should generally be represented with mock objects.

Cucumber on the other hand focuses on system testing from the UI all the way through the data persistence layer.

Unit testing = Mechanical Engineer testing his new engine in a lab setting mounted on a harness.

Cucumber testing = Test driver putting it on a track for a spin.

answered 2010-11-17T14:16:34.540

Your Answer