Your SlideShare is downloading. ×
Python Ireland Feb '11 Talks: Advanced Unit Testing
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Python Ireland Feb '11 Talks: Advanced Unit Testing

895
views

Published on

"Advanced unit testing in Python" by Rory Geoghegan …

"Advanced unit testing in Python" by Rory Geoghegan
Level: Intermediate
Abstract:
Now that you have played around with the rudimentaries of the unittest module, and started writitng tests for your code, how can you make things easier? I'll go over the new additions to the unittest module in Python 2.7, the use of the mock library, and how to use them together to write effective unit tests.

Demo source code:
github.com/​rgeoghegan/​python-ireland-2011-02-unittests/​tree/​master

Video:
http://vimeo.com/groups/pythonireland/videos/20240436

Thanks to all who came along. Approx. 30 people turned up.

Thanks to Science Gallery for being our host.
sciencegallery.com/​

Published in: Technology

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
895
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
8
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Advanced Unittesting in Python Rory Geoghegan Python Dublin - February 2011
  • 2. Look Ma! I’m Unittesting!• Battery of unit tests• Really good coverage• TDD (well, sometimes)• Push it farther
  • 3. Python 2.7Backported in unittest2
  • 4. Asserts, oh my!• assertAlmostEqual• assertGreater• assertRaisesRegexp• assertRegexpMatches• assertMultiLineEqual• assertIn
  • 5. Build it up, tear it down Use setUp
  • 6. Build it up, tear it down Use setUp setUpClass
  • 7. Build it up, tear it down Use setUp setUpClass setUpModule
  • 8. Yours to discover!python -m unittest discover -s [path]
  • 9. Mock!
  • 10. More Mock!
  • 11. For more information,http://github.com/rgeoghegan/python-ireland-2011-02- unittests