+ All Categories
Home > Technology > Practiced agile developer with tdd & bdd

Practiced agile developer with tdd & bdd

Date post: 05-Dec-2014
Category:
Upload: sakares-saengkaew
View: 473 times
Download: 6 times
Share this document with a friend
Description:
 
24
Practiced Agile Developer with TDD and BDD by Sakares Saengkaew Software Development and Quality Improvement, Asian Institute of Technology
Transcript
Page 1: Practiced agile developer with tdd & bdd

Practiced Agile Developer with TDD and BDD by Sakares SaengkaewSoftware Development and Quality Improvement, Asian Institute of Technology

Page 2: Practiced agile developer with tdd & bdd

How many hours testing of your software? When will you perform testing? What happens?

● 8 hours?● 10 % of project work hours.● before deployment 5 days and some bugs

still be unsolved left.● complicate unsolvable bug.● Need more time to debug.● Just show to customer and wish they will not

see unexpected scene.

Page 3: Practiced agile developer with tdd & bdd

How should we make it better?

- Change the way of coding by TDD !

Page 4: Practiced agile developer with tdd & bdd

What's TDD ?- abbreviated from "Test Driven Development".

- a programming technique based on a very simple rule :

Only ever write code to fix a failing test.

Page 5: Practiced agile developer with tdd & bdd

What's TDD ?- Test first, then code and design afterward.

Page 6: Practiced agile developer with tdd & bdd

What's TDD ?- But It's not finished yet.- We call it refactoring to better communicate that the last step is about transforming the current design toward a better design.

Page 7: Practiced agile developer with tdd & bdd

How to ?- Using Unit Test. For example, JUnit in Java, BoostTest in C++ or UnitTest in Ruby on Rails.

- Perform Red-Green-Refactor principle.

Page 8: Practiced agile developer with tdd & bdd

Red-Green-Refactor- Firstly, write a test. Hence, it failed (Red) since there is no functionality code at start.- Secondly, make it pass by simply implementing the missing functionality. Then it turn pass (Green).- Last, refactoring. As we improve the design of the code without altering its external behavior, all tests should pass and, thus, we should remain green.

Page 9: Practiced agile developer with tdd & bdd

Brief summary : TDD- TDD is when you use Automated Testing (usually Unit Testing) as a design practice.- TDD ensures high quality code.- Release work with confident.- Make a collective code ownership since unit test suite is a clear document that every developer in teams can read, follow and write by individual.

Page 10: Practiced agile developer with tdd & bdd

But the defect of TDD- The unit tests still test the behavior of the method. - It may be difficult to trace the behavior of the method directly to the behavior that the external stakeholders asked for and/or understand.- Hence, we consider BDD .

Page 11: Practiced agile developer with tdd & bdd

What's BDD ?- abbreviated from "Behavior Driven Development".- BDD is an extension/revision of TDD.- BDD specifies that tests of any unit of software should be specified in terms of the desired behavior of the unit.

Page 12: Practiced agile developer with tdd & bdd

What's BDD ?- Borrowing from agile software development the "desired behavior" in this case consists of the requirements set by the business.- BDD utilizes a "Ubiquitous Language", a body of knowledge that can be understood by both the developer and the customer. Moreover, it is used to shape and develop the requirements and testing needed, at the level of the customer's understanding.

Page 13: Practiced agile developer with tdd & bdd

How to ?- Popular BDD tools include Cucumber, RSpec, SpecFlow and others. - To explain how to perform simply BDD, we will illustrate from the Cucumber tool by Ruby language .

Page 14: Practiced agile developer with tdd & bdd

BDD by Cucumber 1: Describe behaviour in plain text

Page 15: Practiced agile developer with tdd & bdd

BDD by Cucumber 2: Write a step definition in Ruby

Page 16: Practiced agile developer with tdd & bdd

BDD by Cucumber 3: Run and watch it fail

Page 17: Practiced agile developer with tdd & bdd

BDD by Cucumber 4: Write code to make the step pass

Page 18: Practiced agile developer with tdd & bdd

BDD by Cucumber 5: Run again and see the step pass

Page 19: Practiced agile developer with tdd & bdd

BDD by Cucumber 6: Repeat 2-5 until green like a cuke

Page 20: Practiced agile developer with tdd & bdd

Brief summary : BDD- BDD is when you use Automated Testing to flesh out & capture domain logic starting from the (high-enough) functional testing down to the domain unit logic.- BDD ensures high cohesion between technical implementation and the domain. - makes sense to business via the domain units and behaviour that domain experts understand.

Page 21: Practiced agile developer with tdd & bdd

Summary : What's different between TDD and BDD ?- BDD focuses on the behavioural aspect of the system rather than the implementation aspect of the system that TDD focuses on. - BDD gives a clearer understanding as to what the system should do from the perspective of the developer and the customer. - TDD only gives the developer an understanding of what the system should do.

Page 22: Practiced agile developer with tdd & bdd

Summary - One of the principles in agile, "Responding to change over following a plan". This means that do not know in advance what you have to build. - TDD and BDD support the change since you can write exactly needed feature. Also prevent overproduction.

Page 23: Practiced agile developer with tdd & bdd

Summary - "Customer collaboration over contract negotiation". It's clear by using BDD. Customer become to cooperate in software development. Sharpen the product requirement in business aspect.

Page 24: Practiced agile developer with tdd & bdd

Reference● Practices of an agile developer: working in the real world

by Venkat Subramaniam, Andy Hunt● Test Driven: Practical TDD and Acceptance TDD for Java

Developers by Lasse Koskela● The Cucumber Book: Behaviour-Driven Development for

Testers and Developers by Matt Wynne, Matt Wynne● http://www.anitpatel.net/2012/06/14/what-is-the-difference-

between-tddatddbdd-in-agile-development/● http://en.wikipedia.org/wiki/Behavior-driven_development● http://programmers.stackexchange.

com/questions/21870/can-you-be-agile-without-doing-tdd-test-driven-development

● http://cukes.info/


Recommended