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?
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
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.
I think this is absolutely correct, please find examples here and here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With