Introducing Test Driven Development to an existing environment

Post on 15-Apr-2017

269 views 2 download

Transcript of Introducing Test Driven Development to an existing environment

Test Driven Development in an existing project

Alain Thoen

How to define Test Driven Development

2

What kind of tests couldwe want to write?

Can we return the correct list of contracts?

Was the correct percentage applied?

Check if it copies the correct contracts and

leave the others merely updated.

3

How to define Test Driven Development

4

A method that will help you improve your FUTURE code-design, resulting in a better architecture and cleaner code base

Having a bunch of unit tests is just a happy side effect

Sometimes referred to as Test Driven Design

The benefits of TDD and Unit Tests

5

The disadvantages of TDD and Unit Tests

6

Should I implement TDD in my existing project?

7

• How long will you remain on the project

• How large is the project

• What is the team situation and what is

your own position within the team

• Other potential problems that need to be

resolved before addressing unit testing

Convincing your team

8

Convincing your team

9

Identifying clear obstacles that stand in the way of TDD

10

11

Original Code

12

Reworked with Dependency Injection and Repository Pattern

Real Repository

14

Mock Repository

Practicing/Teaching TDD when starting out

15

16

Assign/Act/Assert example

Summarize

17

• TDD is a method that will help you improve your FUTURE code-design, resulting in

better architecture and cleaner code base

• Benefits of TDD, faster development time, less bugs, better code design

• We learned when to implement TDD. Nearly always!

• We talked about some of the dangers around TDD and how best to avoid them

• We talked about some common issues with implementing TDD in an existing

problems and how to solve it with Dependency Injection

• And last, I showed you an easy way to learn TDD and reap some of the benefits right

away