Python Testing Course

Go to class
Write Review

Free Online Course: Python Testing Course provided by Treehouse is a comprehensive online course, which lasts for 1-2 hours worth of material. The course is taught in English and is free of charge.

Overview
  • Every project can benefit from testing and Python's testing library is solid, strong, and easy to learn and use. In this course, we'll learn about doctests, Python's unittest library, and the super-handy third-party package coverage.py. Come along and learn to assert yourself!

    What you'll learn

    • Doctests
    • Unit tests
    • Test cases
    • coverage.py

Syllabus
  • First Steps With Testing

    Testing is often a daunting subject. Let's break down some of the common words and then learn about the two basic types of testing in Python, doctests and unit tests.

    Chevron 5 steps
    • What Is Testing?

      1:54

    • Writing and Running Doctests

      12:11

    • Create a Doctest

      1 objective

    • Your First unittest Test Case

      5:41

    • Simple Unit Test

      2 objectives

    Be Assertive

    Now that we know how to start a TestCase, let's look at some of the assertions that Python provides us with.

    Chevron 6 steps
    • Quantitative Assertions

      6:30

    • assertTrue and assertFalse

      2 objectives

    • Membership and Other Assertions

      8:08

    • assertIn

      2 objectives

    • Exceptions

      3:27

    • assertRaises

      2 objectives

    Covering Your Bases

    Writing tests is great but you still need to know when you've tested enough and when you're missing something important. Coverage.py gives us very useful feedback to judge how effective our testing is.

    Chevron 3 steps
    • Using Coverage

      5:04

    • HTML Reports

      4:23

    • Review: Python Testing

      6 questions