bdd programming code example
Example 1: bdd advantages
BDD advantages and disadvantages
1. BDD is focused on discovering and developing
features that brings high business value,
so any feature that does not bring value will be ignored.
2. Because of the reduced waste,
the development process will be focused
just on the features that matters,
so any additional cost is reduced.
3. The requirements changes will be easier
to implement because of the living documentation
and safer because of the executable specification,
which will act as automated acceptance and unit tests.
4.The releases will become more frequen
t as the large number of automated tests
will eliminate some of the manual testing
done by the testers. The testers will have
more time to focus on other more complicated
tests and scenarios.
The main BDD disadvantages are:
1. BDD practices are very focused on discussions
and collaboration between all parties involved.
In case the business owners are unwilling or
unable to engage in conversions and give
feedback in time, then it will be hard
to take advantage of BDD.
2.One of the BDD principles assume that
it is very hard to know all the requirements
from the beginning and that we don’t have to
define them all in the first phase of a project,
but instead the knowledge of the stakeholders
will evolve during the lifetime of a project.
That is why it is considered that BDD is well
suited to be used in conjunction with Agile
3.In some cases, for example large projects
developed by corporations, which delegates
the work to multiple remote teams, will be
harder for them to enable the
high collaboration between teams.
4. For some complex applications,
it will require experience to design
and write the automated acceptance tests.
In case the application will acquire many
poorly written tests, they will become hard to maintain.
Example 2: why do you use bdd framework
BDD is extension of TDD(test driven development)
-In BDD we are writing SCENARIOS from
End Users perspective.
BDD has 2 sides:
1- Business side: Feature files where we use
Gherkin language to write our scenarios.
Gherkin is very similar to English. That's why
it makes everyone in the team on the same page
Also there is
2-Implementation Side: Where we actually implement
the programming logic that automates the application.