Effective BDD with Cucumber.doc
Transcript of Effective BDD with Cucumber.doc
Effective BDD with Cucumber The reality of our BDD world. Most of the teams that use cucumber or any other BDDtool have adopted them as QA tools. There developers or business or product peoplenever look at these tests and are sole responsibility of QA team. Does this soundsfamiliar do you do it the same way is cucumber killin! you
BDD is an evolution of TDD and by definition it
aims to help focus development onthe delivery of prioritized, verifiable business value by providing a commonvocabulary that spans the divide between Business and Technology . There are varioustools and frameworks that can be used to implement BDD and cucumber is by far themost used.
Before you decide that cucumber isn"t the ri!ht option for you# lets analy$e differentreasons that make usin! cucumber less effective%
&. Test written by QA team only% The bi!!est advanta!e of BDD is inenforcin! more collaboration amon!st different roles in pro'ects. (hendevelopers are not writin! a sin!le feature test# then there is no behavior drivedevelopment and the collaboration is not achieved. The tests in this scenario willbe re!ression tests and not inline with the system desi!n.
). Test written only by Developers: A!ain we loose the collaborationaspect here but what we lose more is the user intent. QAs brin! the user aspectto software testin!# with QAs input we can avoid writin! scenario that end userwill never face and hav better user e*perience implemented in our system.
+. Product Owners: ,n an ideal scenario in BDD world we e*pect BAs or-roduct mana!ers to write feature tests with QAs. But , haven"t seen this modelbein! successful anywhere. , haven"t seen any product mana!er buyin! this ideaever. The best option to !et the business intent into our tests is to have cleardeliverables and acceptance criteria in our user stories. These can then betranslated into feature tests by QAs and developers.
. Regression suite: Cucumber tests are very valuable in providin!feedback and they ma'orly serve the purpose of testin! various inte!ration pointsin your system. /sin! them as re!ression suite by testin! all possible ne!ativeuse cases will not be fruitful. The well known test automation pyramidrecommends the amount of inte!ration tests should be around 01&0 2 of entiretests and this applies to cucumber tests as well.
Automation Pyramid
0. Java script testing: (ith the ever risin! popularity of selenium1webdriverthe amount of 'ava script testin! in cucumber testin! is also very much inpractice. , have even seen team duplicatin! there entire tests to run a!ainst ,E.3ust because the tool supports these features doesn"t !uarantees return if usedat lar!e scale. 3ava scripts test in selenium have been historically brittle and willcontinue to be. The effective way is to use a 3ava script testin! frameworklike 3asmine and few end to end tests in 4elenium to test the /,.
5. Test Case documentation: (hile writin! BDD tests we don"tadd comments to our tests as the feature tests serves the purpose ofdocumentation. Doesn"t this applies to your manual test cases Teams use testcase mana!ement systems to document there test cases# with BDD you should!et rid of that as well. Cucumber features are very effective way to mana!e testcases that are re!ularly updated without any e*tra effort.
BDD is a !reat practice to make your development cycle effective and cucumber is anama$in! framework for writin! tests and collaboration. 6ou 'ust need to do it ri!ht.