Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
TDD in Python

PyDayBo
Facoltà di Ingegneria
Università di Bologna
18 marzo 2010

Roberto Bettazzoni
roberto@bettazzoni.it
Test Driven Development

Agile practice
Prerequisites
●

Code refactoring

●

Incremental design

●

Test First Programming

●

Unit Test
Code Refactoring

“In software engineering, ‘refactoring’ source code
means improving it without changing its overall
resu...
Incremental Design

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

“Write a failing automated test before changing any
code.”
Kent Beck, Extreme Programming Explaine...
Unit Test

White box test at code level
Test-Driven Development

Test First Programming
+ Code Refactoring
+ Incremental design
+ very short iterations (minutes)
The T.D.D. process
Add a test
Run tests
see new failure

Refactor

Write some code

Run tests
see all pass
DEMO
The legacy

expenses.py
Python script used by the employees when they
are abroad to collect the expenses
Expenses.py examples
> expenses.py reset
> expenses.py list
> expenses.py put lunch 28.00
> expenses.py put gasoline 50
> ...
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...
Idea
Tasks
●

Create a web server

●

Create the HTML page (ask Peter)

●

Read the HTTP parameters

●

Test the legacy

●

●

...
Agile Manifesto
We are uncovering better ways of developing
software by doing it and helping others do it.
Through this wo...
License agreement
●

●

At least part of the material used in this presentation has been
licensed as Creative Common, non-...
Upcoming SlideShare
Loading in …5
×

Presentation TDD in Python

499 views

Published on

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

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Presentation TDD in Python

  1. 1. TDD in Python PyDayBo Facoltà di Ingegneria Università di Bologna 18 marzo 2010 Roberto Bettazzoni roberto@bettazzoni.it
  2. 2. Test Driven Development Agile practice
  3. 3. Prerequisites ● Code refactoring ● Incremental design ● Test First Programming ● Unit Test
  4. 4. Code Refactoring “In software engineering, ‘refactoring’ source code means improving it without changing its overall results.” Wikipedia: refactoring
  5. 5. Incremental Design “Invest in the design of the system every day.” Kent Beck, Extreme Programming Explained 2nd Ed. 2004
  6. 6. Test First Programming “Write a failing automated test before changing any code.” Kent Beck, Extreme Programming Explained 2 nd Ed. 2004
  7. 7. Unit Test White box test at code level
  8. 8. Test-Driven Development Test First Programming + Code Refactoring + Incremental design + very short iterations (minutes)
  9. 9. The T.D.D. process Add a test Run tests see new failure Refactor Write some code Run tests see all pass
  10. 10. DEMO
  11. 11. The legacy expenses.py Python script used by the employees when they are abroad to collect the expenses
  12. 12. 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 lunch 51.50 > expenses.py get lunch hotel 136.50 > expenses.py get 186.50
  13. 13. 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
  14. 14. Idea
  15. 15. 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!
  16. 16. 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.
  17. 17. 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.

×