Successfully reported this slideshow.

Python Ireland Feb '11 Talks: Advanced Unit Testing

1,270 views

Published on

"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
  • Be the first to comment

  • Be the first to like this

Python Ireland Feb '11 Talks: Advanced Unit Testing

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

×