Management theories Applied Behaviour Behaviour Modification.
Behaviour drivendevelopment
-
Upload
young-alista -
Category
Technology
-
view
34 -
download
0
Transcript of Behaviour drivendevelopment
![Page 1: Behaviour drivendevelopment](https://reader036.fdocuments.in/reader036/viewer/2022070513/5885e7031a28ab906d8b7553/html5/thumbnails/1.jpg)
Behaviour Driven Development with Cucumber for Java
![Page 2: Behaviour drivendevelopment](https://reader036.fdocuments.in/reader036/viewer/2022070513/5885e7031a28ab906d8b7553/html5/thumbnails/2.jpg)
BDDDomain Driven Design - DDD● Common understanding● Common language● Test Driven Development - TDD● Good technical practices● Small steps● Combined → Behaviour Driven Development
![Page 3: Behaviour drivendevelopment](https://reader036.fdocuments.in/reader036/viewer/2022070513/5885e7031a28ab906d8b7553/html5/thumbnails/3.jpg)
Test automation
Test Driven Development, TDD – Develop it the right way Behaviour Driven Development, BDD – Develop the right thing
![Page 4: Behaviour drivendevelopment](https://reader036.fdocuments.in/reader036/viewer/2022070513/5885e7031a28ab906d8b7553/html5/thumbnails/4.jpg)
Three core principles• Business and Technology should refer to the same system in
the same way• Any system should have an identified, verifiable value• Up-front analysis, design and planning all have a diminishing
return
![Page 5: Behaviour drivendevelopment](https://reader036.fdocuments.in/reader036/viewer/2022070513/5885e7031a28ab906d8b7553/html5/thumbnails/5.jpg)
Common languageUsed by all involved• Customer• Developers• Others?
![Page 6: Behaviour drivendevelopment](https://reader036.fdocuments.in/reader036/viewer/2022070513/5885e7031a28ab906d8b7553/html5/thumbnails/6.jpg)
Verifiable value• Protect revenue• Increase revenue• Manage cost• Increase brand value• Make the product remarkable• Provide more value to your customer
![Page 7: Behaviour drivendevelopment](https://reader036.fdocuments.in/reader036/viewer/2022070513/5885e7031a28ab906d8b7553/html5/thumbnails/7.jpg)
Big design up-front• No big design up-front• The further you plan ahead, the less accurate you will be
![Page 8: Behaviour drivendevelopment](https://reader036.fdocuments.in/reader036/viewer/2022070513/5885e7031a28ab906d8b7553/html5/thumbnails/8.jpg)
Three questions• What is the most important thing the system should do?• What is the next most important thing the system doesn't do
yet?• If we were to switch off the system, where and what would be
the biggest impact?
![Page 9: Behaviour drivendevelopment](https://reader036.fdocuments.in/reader036/viewer/2022070513/5885e7031a28ab906d8b7553/html5/thumbnails/9.jpg)
Time to create a specification
![Page 10: Behaviour drivendevelopment](https://reader036.fdocuments.in/reader036/viewer/2022070513/5885e7031a28ab906d8b7553/html5/thumbnails/10.jpg)
Time to create a specificationWhen are we done?
![Page 11: Behaviour drivendevelopment](https://reader036.fdocuments.in/reader036/viewer/2022070513/5885e7031a28ab906d8b7553/html5/thumbnails/11.jpg)
Interpret and translate We need to read the spec. Understand it Translate it into code Parse and execute it? No, not all specs are created equal
![Page 12: Behaviour drivendevelopment](https://reader036.fdocuments.in/reader036/viewer/2022070513/5885e7031a28ab906d8b7553/html5/thumbnails/12.jpg)
Solution Write specifications so Translations isn't needed It is possible to execute them
![Page 13: Behaviour drivendevelopment](https://reader036.fdocuments.in/reader036/viewer/2022070513/5885e7031a28ab906d8b7553/html5/thumbnails/13.jpg)
Format• Given – Setup the system• When – Change the state of the system• Then – Verify the new state
![Page 14: Behaviour drivendevelopment](https://reader036.fdocuments.in/reader036/viewer/2022070513/5885e7031a28ab906d8b7553/html5/thumbnails/14.jpg)
Tools
![Page 15: Behaviour drivendevelopment](https://reader036.fdocuments.in/reader036/viewer/2022070513/5885e7031a28ab906d8b7553/html5/thumbnails/15.jpg)
Audience Readers Customers Developers Maintainers Product owner Developers
![Page 16: Behaviour drivendevelopment](https://reader036.fdocuments.in/reader036/viewer/2022070513/5885e7031a28ab906d8b7553/html5/thumbnails/16.jpg)
Why Cucumber
It is one of the least technical tools It is a very active open source project It supports a variety of languages
![Page 17: Behaviour drivendevelopment](https://reader036.fdocuments.in/reader036/viewer/2022070513/5885e7031a28ab906d8b7553/html5/thumbnails/17.jpg)
A concrete exampleFeature: Life of IT guysIn order to get good salaryAs a it guyI want to keep my boss happy
Scenario: I am a testerGiven I am a bad testerWhen I go to workThen I mess with itAnd my boss fires meBut the developer likes me
![Page 18: Behaviour drivendevelopment](https://reader036.fdocuments.in/reader036/viewer/2022070513/5885e7031a28ab906d8b7553/html5/thumbnails/18.jpg)
Advantages
The format is● Easy to read● Easy to understand● Easy to discuss● Easy to parse
![Page 19: Behaviour drivendevelopment](https://reader036.fdocuments.in/reader036/viewer/2022070513/5885e7031a28ab906d8b7553/html5/thumbnails/19.jpg)
Parse and execute
● A parser is developed● Add native code to implement the steps Setup – Given Execute – When Assert - Then
![Page 20: Behaviour drivendevelopment](https://reader036.fdocuments.in/reader036/viewer/2022070513/5885e7031a28ab906d8b7553/html5/thumbnails/20.jpg)
Write a step definition in Java@Given("^I am a bad tester$")public void I_am_a_bad_tester(){System.out.println("@Given--I am a bad tester");}@When("^I go to work$")public void I_go_to_work(){System.out.println("@When---I go o work");}@Then("^I mess it$")public void I_mess_with_it(){System.out.println("@Then--I mess it");}@And("^my boss fires me$")public void my_boss_fires_me(){System.out.println("@And---my boss fires me");}@But("^the developer likes me$")public void the_developer_likes_me(){System.out.println("@But--the developer likes me");Assert.assertTrue(false);
}
![Page 21: Behaviour drivendevelopment](https://reader036.fdocuments.in/reader036/viewer/2022070513/5885e7031a28ab906d8b7553/html5/thumbnails/21.jpg)
Run it and watch it fail
![Page 22: Behaviour drivendevelopment](https://reader036.fdocuments.in/reader036/viewer/2022070513/5885e7031a28ab906d8b7553/html5/thumbnails/22.jpg)
Write code to make the step pass@Given("^I am a [a-zA-Z]{1,} tester$")public void I_am_a_bad_tester(){System.out.println("@Given--I am a bad tester");}@When("^I go to work$")public void I_go_to_work(){System.out.println("@When---I go o work");}@Then("^I [a-zA-Z]{1,} it$")public void I_mess_with_it(){System.out.println("@Then--I mess it");}@And("^my boss [a-zA-Z]{1,} me$")public void my_boss_fires_me(){System.out.println("@And---my boss fires me");}@But("^the developer [a-zA-Z]{1,} me$")public void the_developer_likes_me(){System.out.println("@But--the developer likes me");
}
![Page 23: Behaviour drivendevelopment](https://reader036.fdocuments.in/reader036/viewer/2022070513/5885e7031a28ab906d8b7553/html5/thumbnails/23.jpg)
Run it again and see the step pass
![Page 24: Behaviour drivendevelopment](https://reader036.fdocuments.in/reader036/viewer/2022070513/5885e7031a28ab906d8b7553/html5/thumbnails/24.jpg)
Why is Cucumber better● Compared to well known tools like JUnit?● It isn't, it's just easier to read for non coders● The readability has increased● Communication is easier
![Page 25: Behaviour drivendevelopment](https://reader036.fdocuments.in/reader036/viewer/2022070513/5885e7031a28ab906d8b7553/html5/thumbnails/25.jpg)
Benefits
● Less unnecessary work● Better regression tests● Less speculative work● Less re-work
![Page 26: Behaviour drivendevelopment](https://reader036.fdocuments.in/reader036/viewer/2022070513/5885e7031a28ab906d8b7553/html5/thumbnails/26.jpg)
Maintenance Maintained together
● Specs● Tests● Code
Maven Continuous Integration, CI
![Page 27: Behaviour drivendevelopment](https://reader036.fdocuments.in/reader036/viewer/2022070513/5885e7031a28ab906d8b7553/html5/thumbnails/27.jpg)
Tips Always use the a common language Don't over specify – start easy Never specify implementation details
![Page 28: Behaviour drivendevelopment](https://reader036.fdocuments.in/reader036/viewer/2022070513/5885e7031a28ab906d8b7553/html5/thumbnails/28.jpg)
Do not focus on tools
• They will never solve the problem• A fool with a tool is still a fool
![Page 29: Behaviour drivendevelopment](https://reader036.fdocuments.in/reader036/viewer/2022070513/5885e7031a28ab906d8b7553/html5/thumbnails/29.jpg)
Resources Cucumber - http://cukes.info/ Selenium - http://seleniumhq.org/ Maven - http://maven.apache.org/ Jenkins - http://jenkins-ci.org/ Blog
-http://thomassundberg.wordpress.com/
![Page 30: Behaviour drivendevelopment](https://reader036.fdocuments.in/reader036/viewer/2022070513/5885e7031a28ab906d8b7553/html5/thumbnails/30.jpg)
Thank You