Agile and test driven development

Post on 07-Jan-2017

63 views 1 download

Transcript of Agile and test driven development

Agile And Test Driven Development

Agenda1. Waterfall vs Agile

2. Agile intro

3. SCRUM

4. 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

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

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)

Agile

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.”

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.

Agile Development Cycle● the initial planning

● analysis is kept to a very high level

● analysing, designing, developing and testing

● 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.

● inspect-and-adapt

● analysis paralysis

● Agile and stakeholders

Benefits of Agile

Types of agile:

● Scrum

● Kanban

● Extreme programming

● Lean software 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)

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

Evolutions

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

Scrum

Scrum

● Split your organization

● Split your work

● Split time

Things we do in Scrum ..

● Backlog

● User stories

● Work estimation

● Roadmap

● Daily scrum meeting

Daily Scrum meeting

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

Test-Driven Development (TDD)

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.

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).

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

What should be tested?

● Valid inputs

● Invalid inputs

● Errors, exceptions, and events

● Boundary conditions

● Everything that could possibly break!

TDD Benefits for Developers

● Much less debug time

● Code proven to meet requirements

● Don’t write any un-necessary code

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

Thanks !