To make it speedy Cucumber gives an easy to write and coding interface.It is an iterative development and testing process where tests are written before real development of code of the real application. So in the initial phase, all tests are suppose to be failed but slowly, when developers start implementing the features, tests start passing.BDD is an extension of TDD. Cucumber or JBehave acts as a bridge between Business and Technical language.
Here is a nice link on BDD- https://www.atlassian.com/blog/software-teams/making-the-shift-to-behavior-driven-development
- Unit tests are code driven and actually produces code. Driven by Business value.
- Business drives the development via testing process that focuses on behavior rather than developed code.
- Refactoring improves the code and stability of the application
- Test first approach reduces the cost of bugs
- Simple Given,When and Then approach,so all stakeholders can design the feature of the application.It provides an easy colaboration between stakeholders,business analyst,QA team and developers.
- Free style English writing focuses on user experience. Easy to understand.
- Quick,Easy to setup and executable.
- Efficient tool for testing.
- User can provide example to clarify requirements.
- Tests become part of the maintenance overhead
- Tests needs to be rewritten when requirements change
- It targets the unit level coding rather than what the code should actually do
- Sometimes developer team find it waste of time if it is too poor.
Cucumber is a tool that can execute a plain text functional description as automation test.So cucumber is an acceptance testing tool but not an automation tool and Gherkin is an acceptance testing language.Cucumber acting as a bridge collaborates between stakeholders of the projects .Cucumber originally built in Ruby but currently supports java.
Cucumber needs the following jars:
Open Eclipse,Create a java Project, right click on the project , go to build path then configure build path and click on library lab and click on Add External jar, select cucumber jars to add. Click on Open to add the them to the project.
Add all selenium related jars in the same way to the project.
Now for setting up the project, we need to create two packages
source contains all of the source code coming from developers and test is going to hold all test classes and methods.
While moving toward TDD or BDD the core principle would be:
1. Developers will not touch or code anything other than covering the failing testcases.
2. The testcase will cover the acceptance criteria for an user story.
3. There should be a joint effort to write the testcases. Developers, testers and customers should join in the writing process of the testcase development
4. Test engineer will automate the testcases only and they should be automated in such a way that they can be executed anytime of the software development life cycle.