Agile and test driven development

32
Agile And Test Driven Development

Transcript of Agile and test driven development

Page 1: Agile and test driven development

Agile And Test Driven Development

Page 2: Agile and test driven development

Agenda1. Waterfall vs Agile

2. Agile intro

3. SCRUM

4. Test-Driven Development

Page 3: Agile and test driven development

● You complete one phase (e.g. Design) before moving on to the next phase (e.g. Development)

● You rarely aim to revisit a 'phase' once it's completed

Waterfall development

Page 4: Agile and test driven development
Page 5: Agile and test driven development

But ..

● You don't realize any value until the end of the project

● You leave the testing until the end

● You don't seek approval from the stakeholders until late in the day

This approach is highly risky, often more costly and generally less efficient than agile approaches

Page 6: Agile and test driven development

Waterfall Vs Agile

● Waterfall model

phase by phase: analysis > design > development > testing and delivery of whole functionality

● Agile model

analysis > design > development > testing and delivery of a small functional pieces in with short cycles (Sprints)

Page 7: Agile and test driven development
Page 8: Agile and test driven development

Agile

Page 9: Agile and test driven development

what is agile ?

● In 1970, Dr. Winston Royce presented a paper entitled “Managing the Development of Large Software Systems.

● In February 2001, seventeen software developers met at the Snowbird resort in Utah to discuss lightweight development methods. They published the Manifesto for Agile Software Development.

● agile methodology is described as “iterative” and “incremental.”

Page 10: Agile and test driven development

what is agile ? ,continue

● In an agile paradigm, every aspect of development — requirements, design, etc. — is continually revisited throughout the lifecycle.

● Agile methodology is an alternative to traditional project management, typically used in software development. It helps teams respond to unpredictability through incremental, iterative work cadences, known as sprints. Agile methodologies are an alternative to waterfall, or traditional sequential development.

Page 11: Agile and test driven development

Agile Development Cycle● the initial planning

● analysis is kept to a very high level

● analysing, designing, developing and testing

Page 12: Agile and test driven development

● An iteration is simply a fixed, short period of time that the team chooses to work within.

● Typically for agile teams, an iteration is between 1 week and 30 days.

● Strictly speaking, the Scrum agile development methodology advocates 30 days .

● The Extreme Programming agile methodology advocates 1 week.

Page 13: Agile and test driven development
Page 14: Agile and test driven development

● inspect-and-adapt

● analysis paralysis

● Agile and stakeholders

Benefits of Agile

Page 15: Agile and test driven development

Types of agile:

● Scrum

● Kanban

● Extreme programming

● Lean software development

Page 16: Agile and test driven development

Agile principles

The Agile Manifesto is based on twelve principles:

1. Customer satisfaction by early and continuous delivery of useful software2. Welcome changing requirements, even in late development3. Working software is delivered frequently (weeks rather than months)4. Close, daily cooperation between business people and developers5. Projects are built around motivated individuals, who should be trusted6. Face-to-face conversation is the best form of communication (co-location)

Page 17: Agile and test driven development

Agile principles ,continue

7. Working software is the principal measure of progress8. Sustainable development, able to maintain a constant pace9. Continuous attention to technical excellence and good design10.

10. Simplicity—the art of maximizing the amount of work not done—is essential11. self-organizing teams12. Regular adaptation to changing circumstance

Page 18: Agile and test driven development

Evolutions

● In 2009, Later, Ken Schwaber with others founded the Scrum Alliance and created the Certified Scrum Master programs and its derivatives.

Page 19: Agile and test driven development

Scrum

Page 20: Agile and test driven development

Scrum

● Split your organization

● Split your work

● Split time

Page 21: Agile and test driven development
Page 22: Agile and test driven development

Things we do in Scrum ..

● Backlog

● User stories

● Work estimation

● Roadmap

● Daily scrum meeting

Page 23: Agile and test driven development

Daily Scrum meeting

Page 24: Agile and test driven development

Scrum planning example

● Iteration cycle of weeks

● Working hour per day is 8

● Product backlog of 20 stories

● Each story effort is 10 hrsTotal hours of work iteration can accommodate

= 8hrs x 5days x 3weeks = 120 hrs● Iteration backlog or number of stories per iteration 12 user story

Page 25: Agile and test driven development

Test-Driven Development (TDD)

Page 26: Agile and test driven development

What is Test-Driven Development?

● In principle, it is just about writing the test before the program

● But in consequence, it leads the developer to: ○ first think about “how to use” the component (why do we need the component, what’s it for?)

○ and only then about “how to implement”.

● So, it’s a testing technique as well as a design technique○ It results into components that are easy to test and enhance.

● In the end, there is no code without a test.

Page 27: Agile and test driven development

Motivation

● If you intend to test after you‘ve developed the system, you won‘t have the time for testing. => Write the tests before the code!

● If things get complicated, you might fear that „the system“ doesn‘t work. => Execute the tests and get positive feedback (everything still works) or get pointed to the bit that does not / no longer work.

● If you don‘t have tests for the code, you shouldn‘t use it / ship it.=> This can‘t happen if you write the test first (so you reach better test coverage than with functional tests).

Page 28: Agile and test driven development

Mechanics of TDD

● Always start with a failing test

● Quickly write the simplest code needed to pass the test

● Remove duplication

● Repeat as needed to meet requirements

● Test everything that could possibly break

Page 29: Agile and test driven development

What should be tested?

● Valid inputs

● Invalid inputs

● Errors, exceptions, and events

● Boundary conditions

● Everything that could possibly break!

Page 30: Agile and test driven development

TDD Benefits for Developers

● Much less debug time

● Code proven to meet requirements

● Don’t write any un-necessary code

Page 31: Agile and test driven development

Getting started with TDD

● Get some training

● Start with a small visible project

● Shoot for 100% test coverage

● Don’t expect to be perfect

● Expect to improve dramatically in time

● Measure the results

Page 32: Agile and test driven development

Thanks !