|Setup Cucumber and More Details On Cucumber|
A short introduction of BDD
BDD (Behavior driven development) is an evolution in the thinking of test driven development (TDD) and Acceptance Test Driven development(ATDD) Planning. Test automation team usually take reference from requirement documents and automate in similar fashion to how the developer develop the application. It creates ambiguity between how test and development team interprete the requirements. On top of it automation is done after the development is completed.
In Cucumber driven testing the gherkins syntax is the acceptance criteria and it becomes the requirement documentation for both development and testing team.
A Unit test check if developers are building the thing right and an acceptance test is to check if the developers are building the right things. BDD aims to help focus development on delivery of prioritized,verifiable,business value by providing a common vocabulary (ubiquitous language) that spans the divide between Business and Technology.
A language structured around the domain model and used by all team members to connect all activities of the team with the software.Establishing the goals of different stakeholders requires for a vision to be implemented. Drawing out features which will achieve those goals using feature injection.Involving stakeholders in the implementation process (Acceptance criterias,features etc) using examples to describe the behaviors of the application,or of units of code.Automating those examples to provide quick feedback and regression testing.
Setup Cucumber and More Details On Cucumber:
Cucumber is a BDD(Business driven development) tool that runs acceptance testing.It reads plain test descriptions of the application features with examples and scenarios. later using cucumber they can be converted to automation.It is an easy interface between developer , testers and business people.Many a times it is seen , business personnel who does not code or having little knowledge of coding prefers to do manual testing instead of automation testing. That makes the acceptance testing slower.
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
Overall cucumber takes a big effort to ensure the tests can be read and written by stakeholders themselves. This feature file written in Gherkin is the signed off document form the stakeholders to development and testing team.
What is objectives of using cucumber in BDD?
- Validate if the right system is being built.
- Validate if business,users,customer point of view are captured.
- Validate if the correct elaborative (with example) document is present about what system should do.
- Validate if the teams have the shared understanding of what is being built.
- Validate if the definition of done is achieved.
The expected output of using cucumber in BDD?
- The confirmation of building the system correctly.
- Living documentation(once automated),no need to maintain long time consuming documentation.
- Reduce the volatile ness and cuts down the cross discussion understanding mismatch.
Who are the primary Audience?
- Product Owner(PO)
- Business Owner(BO)
- Business Analysts(BA)
- Subject Matter Experts(SME)
- Cucumber framework helps the business stakeholders to write proper acceptance testing testcases.
- It reduces communication gaps between domain experts and development as well as testing teams
- Under the hood step definition translates business facing language(Gherkins) to actual language(java)
How BDD viz Cucumber works?
Cucumber translates the business language to pure language.
- It is written in plain text.
- It is understood by the business,developers and testers.
- It targets the business requirements.
- Significant proportion of functional specifications are written as user stories.
- It provides just enough living document.
Where to Start?
- BDD cucumber starts with a conversation between stakeholders.
- It is goal is to determine the features and derive acceptance criteria.
- It defines the definition of done.
Core principles of Cucumber
- Developers write the test before the code.
- Developers will not touch or code anything other than covering the failing testcases.
- The testcase will cover the acceptance criteria for an user story.
- There should be a joint effort to write the testcases. Developers, testers and customers should join in the writing process of the testcase development
- These testcases are behavioral or high level tests but not unit tests.
Cucumber is governed by cucumber-Gherkin language.
Advantages of using Cucumber in BDD :
- 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 collaboration 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.
- Ensures automated code coverage.
- Provides valuable tests.
- It relies on shared understanding by discussing examples. Hence all team members know what they are actually trying to achieve.
- 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.