Up: Lectures

Testing

This lecture looks at the basics of testing software.

    1. Introduction (pdf, ppt)
      • Why you should do testing
      • Limitations of testing
      • Introduction to unit tests
      • Basic testing pattern
    2. Exceptions (pdf, ppt)
      • Causes of errors
      • Error handling via status codes
      • Error handling via exceptions
      • Producing informative error messages
      • Raising your own exceptions
    3. Unit Testing (pdf, ppt)
      • Python’s “Nose” library
      • Creating useful test cases
    4. Interface and Implementation (pdf, ppt)
      • The difference between “interface” and “implementation”
      • Isolating components for testing
      • Using StringIO instead of external files
      • Important rules for testing
    5. Floating Point (pdf, ppt)
      • Storing floating point numbers on computers
      • Mathematical operations in floating point systems
      • Absolute and relative error
      • Floating point numbers in testing
    6. Fixtures (pdf, ppt)
      • Why fixtures are useful
      • Creating fixtures using Nose
      • Nose’s “setup” function vs. global variables
      • Using decorators to deal with modified fixtures

Exercises

  1. J Z Miller
    October 25th, 2010 at 04:38 | #1

    Why nose and not unit test?

    • Greg Wilson
      October 25th, 2010 at 06:44 | #2

      Good question: it’s because Nose doesn’t require classes or objects, so newcomers can start with it earlier.

  2. November 25th, 2010 at 20:57 | #3

    Unless it’s somewhere and I missed it, it might be useful to indicate a link or a quick information on how to install nose (e.g. a random one: http://somethingaboutorange.com/mrl/projects/nose/0.11.2/)

  3. Thomas Sandmann
    February 8th, 2011 at 09:51 | #4

    The link Magali supplied seems to have changed into http://somethingaboutorange.com/mrl/projects/nose/1.0.0/

  4. February 10th, 2011 at 22:48 | #5

    Shameless self promotion: I’ve uploaded a presentation about using testing frameworks that I wrote a couple of years ago. It has all-new audio.

    http://4dpiecharts.com/2011/02/10/presentation-on-testing-frameworks/