cilap
cilap

Reputation: 2333

cucumber.js for BDD unit testing?

I am wondering if it is possible to use cucumber(js) for BDD unit testing? Cucumber is known to be runable as a acceptance testing framework. But I have never seen examples if and how cucumber may be used as a BDD unit testing.

Is cucumber able to provide unit tests? Is it uncommon to use cucumber for unit testing?

Upvotes: 5

Views: 2148

Answers (2)

diabolist
diabolist

Reputation: 4099

BDD is a process/mechanism for driving development by using high level descriptions of the the behavior of the application. Cucumber (in all its forms) is a tool for supporting this process by allowing you to specify high level concepts in a natural language that can be automated. It is not a tool for writing unit tests.

Cucumber is a tool for the outer circle of the BDD process

BDD two circles diagram

But as you can see BDD has an inner circle where unit testing takes place.

When you are in the inner circle sometimes you have to build things to make the outer circle green (other times you will just use existing things). When you build things you require unit tests. In the inner circle the level of abstraction is lower, the amount of detail is much greater, and exhaustive testing is much more important. These combine to make using cucumber for these tests prohibitively expensive and difficult. This is why unit testing tools are a better fit here.

Upvotes: 7

Eugene
Eugene

Reputation: 1895

I think this is absolutely correct, please find examples here and here

Upvotes: 1

Related Questions