Unit Testing with Python

This course will help you to write good unit tests for your Python code, using tools such as unittest, doctest and py.test. Unit tests should improve code quality, and also support future development.
Course info
Rating
(271)
Level
Intermediate
Updated
Nov 1, 2013
Duration
2h 58m
Table of contents
Unit Testing with Python - Basic Example Using unittest
Why and When Should You Write Unit Tests?
Using Pytest for Unit Testing in Python
Testable Documentation with Doctest
Test Doubles: Mocks, Fakes and Stubs
Test Coverage and Parameterized Tests
Description
Course info
Rating
(271)
Level
Intermediate
Updated
Nov 1, 2013
Duration
2h 58m
Description

This course follows on from the Pluralsight "Python Fundamentals" course, and has more detail about unit testing with Python.

In this Python tutorial we will cover libraries and frameworks such as:

  • Unittest
  • Doctest
  • and Py.test

The aim is to help you to write unit tests that improve code quality, and also support future development. Good unit tests should provide immediate value in terms of reduced debugging and better design, and the investment writing them should pay back over the whole lifetime of your software.
Course FAQ
Course FAQ
What is unit testing in Python?

Unit testing is when the smallest parts of a software are tested. It is testing that each unit of the software performs the way it is meant to. Python uses the unittest test framework.

What are some benefits of unit testing with Python?

Some benefits include:

  • Improved code quality
  • Support for future development
  • Reduced debugging
  • Better design
  • Reduced costs
  • Provides documentation
What will I learn in this course?

Ultimately you will learn how to write good unit tests for your Python code. Some of topics you will learn include:

  • Python unittest - what it is and how to use it
  • When and why you should write unit tests
  • Using Pytest for unit testing in Python
  • Testable documentation with Doctest
  • Test doubles: Mocks, Fakes, and Stubs
  • Test coverage and parameterized tests
  • Much more
Who should take this course?

This course is for anyone who wants to learn how to test their Python code through unit tests to improve code quality and support future development. Software developers will especially find this course beneficial.

Are there prerequisites to this course?

In order to understand and fully appreciate how to unit test your Python code, you should understand how to write Python code in the first place and have some experience with software development.

About the author
About the author

Emily is an experienced software developer specializing in Test Driven Development, agile methods, and automated testing in general. She is a well known speaker, coding dojo facilitator, blogger, and author of "The Coding Dojo Handbook".

More from the author
Unit Testing with Python
Intermediate
2h 49m
Jun 28, 2019