presentation tdd in python

17
TDD in Python PyDayBo Facoltà di Ingegneria Università di Bologna 18 marzo 2010 Roberto Bettazzoni [email protected]

Upload: roberto-bettazzoni

Post on 23-Jan-2015

99 views

Category:

Technology


0 download

DESCRIPTION

1 hour Presentation of the basic of TDD in Python 20" Presentation 30" Demo 10" Q&A

TRANSCRIPT

Page 1: Presentation TDD in Python

TDD in Python

PyDayBoFacoltà di IngegneriaUniversità di Bologna

18 marzo 2010

Roberto [email protected]

Page 2: Presentation TDD in Python

Test Driven Development

Agile practice

Page 3: Presentation TDD in Python

Prerequisites

● Code refactoring● Incremental design● Test First Programming● Unit Test

Page 4: Presentation TDD in Python

Code Refactoring

“In software engineering, ‘refactoring’ source code means improving it without changing its overall results.”Wikipedia: refactoring

Page 5: Presentation TDD in Python

Incremental Design

“Invest in the design of the system every day.”Kent Beck, Extreme Programming Explained 2nd Ed. 2004

Page 6: Presentation TDD in Python

Test First Programming

“Write a failing automated test before changing any code.”Kent Beck, Extreme Programming Explained 2nd Ed. 2004

Page 7: Presentation TDD in Python

Unit Test

White box test at code level

Page 8: Presentation TDD in Python

Test-Driven Development

Test First Programming

+ Code Refactoring

+ Incremental design

+ very short iterations (minutes)

Page 9: Presentation TDD in Python

The T.D.D. process

Run testssee new failure

Refactor

Add a test

Write some codeRun tests

see all pass

Page 10: Presentation TDD in Python

DEMO

Page 11: Presentation TDD in Python

The legacy

expenses.py

Python script used by the employees when they are abroad to collect the expenses

Page 12: Presentation TDD in Python

Expenses.py examples

> expenses.py reset> expenses.py list

> expenses.py put lunch 28.00> expenses.py put gasoline 50> expenses.py put lunch 23.50> expenses.py put hotel 85> expenses.py get lunch51.50> expenses.py get lunch hotel136.50> expenses.py get186.50

Page 13: Presentation TDD in Python

User Story

As an employee

I want to use my expenese program via web

so I can collect the expenses with a device

that does not support Python

Page 14: Presentation TDD in Python

Idea

Page 15: Presentation TDD in Python

Tasks

● Create a web server● Create the HTML page (ask Peter)● Read the HTTP parameters● Test the legacy● Refactor the legacy to connect to the HTML

commands● Build the damn thing!

Page 16: Presentation TDD in Python

Agile Manifesto

We are uncovering better ways of developing software by doing it and helping others do it.

Through this work we have come to value:

Individuals and interactions over processes and tools Working software over comprehensive documentation

Customer collaboration over contract negotiation Responding to change over following a plan

That is, while there is value in the items on the right, we value the items on the left more.

Page 17: Presentation TDD in Python

License agreement

● At least part of the material used in this presentation has been licensed as Creative Common, non-commercial, share-alike content (http://creativecommons.org/licenses/by-nc-sa/3.0/de/deed.en) from Roberto Bettazzoni.

● As per the license agreement you are entitled to do whatever you like to the material as far as is not contradicting basic principle of the license. On top of that Roberto Bettazzoni kindly asks you to return any change you will make to this material, for validation and sharing purposes.