let's test!

39
David Funaro Let’s test! Andrea Giuliano #code10 #letstest

Upload: andrea-giuliano

Post on 13-Jan-2015

759 views

Category:

Technology


1 download

DESCRIPTION

Scrivere codice pulito che funzioni.Pur sembrando un'apparente contraddizione che si cela nelle difficoltà della programmazione,lo sviluppo guidato dai test risponde a questa sfida con un paradosso:scrivere test prima dell'implementazione. Lo sviluppo software guidato dai test è una pratica della metodologia Agile che elimina le paure nella scrittura di codice e porta gli sviluppatori ad incrementare drasticamente la qualità delle loro applicazioni. Durante il talk verrà mostrato come l'approccio alla pratica cambi il proprio modo di programmare,rendendolo più divertente,affidabile e proficuo.

TRANSCRIPT

Page 1: Let's test!

David Funaro

Let’s test!

Andrea Giuliano

#code10 #letstest

Page 2: Let's test!

Let’s test!

“Come ho fatto fino ad ora a lavorare senza test?”

“Non tornerei mai più indietro!”

Page 3: Let's test!

Let’s test!

I manually test allmy code’s functionalities

write code features

Page 4: Let's test!

Let’s test!

How (most) developerswrite code today

Page 5: Let's test!

my starting project

Let’s test!

Page 6: Let's test!

CHANGES

Let’s test!

internal external

Page 7: Let's test!

be honest...

Let’s test!

Page 8: Let's test!

Contents...

Let’s test!

I’m looking forward to waste my code

Page 9: Let's test!

Contents...

Let’s test!

What happens when something goes wrong

Page 10: Let's test!

Contents...

Let’s test!

Where can I putmy hands in?

Page 11: Let's test!

Contents...

Let’s test!

one more patch

I’ve got the solution!

Page 12: Let's test!

Contents...

Let’s test!

I madesome mistakes

NO FEEDBACK

Page 13: Let's test!

Let’s test!

? ????

??

I’m hopeless

Page 14: Let's test!

Contents...

Let’s test!

I want to be proudof my code

Page 15: Let's test!

Contents...

Let’s test!

Automatic Test

Page 16: Let's test!

Let’s test!

Page 17: Let's test!

Why automatic tests?

Let’s test!

confidence in your code

progressive input growth

no feartests as documentation easier to alter code

understand HOW code works

working software over comprehensive documentation

easy to rundon’t waste your time

feedback

Page 18: Let's test!

How many kinds of test exists?Unit

FunctionalIntegration

more...

Let’s test!

Page 19: Let's test!

we want short feedback!

Let’s test!

Page 20: Let's test!

stress =1

# tests

Let’s test!

Page 21: Let's test!

Ok, let’s try!I want to write a test for my code

Let’s test!

Page 22: Let's test!

Contents...

Let’s test!

Sounds good......but one day

Page 23: Let's test!

Contents...

Let’s test!

How can I test this?coupling dependencies

Page 24: Let's test!

Let’s test!

I don’t now so I DON’T test

Page 25: Let's test!

Clean code that works cit. Ron Jeffries

predictable way to developlearn all of the lessons that the code has to teach you

improve the lives of the users of your softwarelet your teammates count on you, and you on them

feel good to write code

Let’s test!

Page 26: Let's test!

How do we get to clean code that works?

Many forces drive us away from clean codeand even from clean code that works

Let’s test!

Page 27: Let's test!

Test Driven Development

Let’s test!

Test-driven development is less and more writing test first...but TDD is about design

Test-driven development is a way of managing fear during programming

Page 28: Let's test!

our tasks

Red: write a little test that doesn’t work

Green: make the test work quickly

Refactor: eliminate all the duplication created in merely getting the test to work

feature #1feature #2feature #3

Let’s test!

Page 29: Let's test!

Let’s test!

write a test

Page 30: Let's test!

Let’s test!

write a testit fails!

Page 31: Let's test!

Let’s test!

write a test

make it works

it fails!

Page 32: Let's test!

Let’s test!

write a test

make it works

it fails!awesomeit’s green!

Page 33: Let's test!

Let’s test!

write a test

make it works

do refactor

it fails!awesomeit’s green!

Page 34: Let's test!

Let’s test!

write a test

make it works

do refactor

it fails!awesomeit’s green!

Page 35: Let's test!

what are the benefits?

improve quality of your codebehaviours’ verification

coverage functionalitytest as documentation

long term maintainabilityvery short time feedback about bugs

collaborative working

QA from reactive to proactive

Let’s test!

Page 36: Let's test!

ok, it’s cool but my resources are limited

I want to be cheap

I want to be fast

I want to be good

Let’s test!

Page 37: Let's test!

What about legacy code?

Test new functionalities

Test old functionalities starting from bugs

Let’s test!

Page 38: Let's test!

DEMO

Let’s test!

Page 39: Let's test!

Thanks!

Andrea Giuliano@bit_sharkandreagiuliano.it

David [email protected]

Questions?

Let’s test!