Saturday, 21 July 2018

SE - 25 - Benefits of BDD(Cucumber)

Here are few aspects and benefits of using cucumber:

i) In BDD the end-to-end business scenarios(user stories) are automated

ii) Behaviour of application is focused rather than unit-testcases

iii) It combines business language with testing

iv)  Cucumber has 3-step separation of feature . step and world. It means code reusability with a great extent is supported. Let's see how :

When we write a feature file we write the gherkin scenario as :

Given :
When
Then :

When writing multiple scenarios in a feature few of the steps may be same. If  "Given" condition is same in multiple features we can use the same definition for multiple scenarios.

There is one more advantage, if any code is wrong we just need to modify that particular step only. If "Given" or "Then" or "When" is wrong we just need to modify that step only. 

No comments:

Post a Comment