Let's test!

Preview:

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.

Citation preview

David Funaro

Let’s test!

Andrea Giuliano

#code10 #letstest

Let’s test!

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

“Non tornerei mai più indietro!”

Let’s test!

I manually test allmy code’s functionalities

write code features

Let’s test!

How (most) developerswrite code today

my starting project

Let’s test!

CHANGES

Let’s test!

internal external

be honest...

Let’s test!

Contents...

Let’s test!

I’m looking forward to waste my code

Contents...

Let’s test!

What happens when something goes wrong

Contents...

Let’s test!

Where can I putmy hands in?

Contents...

Let’s test!

one more patch

I’ve got the solution!

Contents...

Let’s test!

I madesome mistakes

NO FEEDBACK

Let’s test!

? ????

??

I’m hopeless

Contents...

Let’s test!

I want to be proudof my code

Contents...

Let’s test!

Automatic Test

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

How many kinds of test exists?Unit

FunctionalIntegration

more...

Let’s test!

we want short feedback!

Let’s test!

stress =1

# tests

Let’s test!

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

Let’s test!

Contents...

Let’s test!

Sounds good......but one day

Contents...

Let’s test!

How can I test this?coupling dependencies

Let’s test!

I don’t now so I DON’T 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!

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!

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

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!

Let’s test!

write a test

Let’s test!

write a testit fails!

Let’s test!

write a test

make it works

it fails!

Let’s test!

write a test

make it works

it fails!awesomeit’s green!

Let’s test!

write a test

make it works

do refactor

it fails!awesomeit’s green!

Let’s test!

write a test

make it works

do refactor

it fails!awesomeit’s green!

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!

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!

What about legacy code?

Test new functionalities

Test old functionalities starting from bugs

Let’s test!

DEMO

Let’s test!

Thanks!

Andrea Giuliano@bit_sharkandreagiuliano.it

David Funaro@ingdavidinodavidfunaro.com

Questions?

Let’s test!