Unit Testing and Test Driven Development in Python

Unit Testing and Test Driven Development in Python

English | MP4 | AVC 1280×720 | AAC 48KHz 2ch | 2 Hours | 369 MB

Every software developer wants to ship high-quality applications. Test-driven development (TDD) is a key discipline that can help you enhance your development process—and, in turn, your code base—by ensuring that crashes and bugs are addressed early on. In this course, join Richard Wells as he covers unit testing and TDD for Python projects. Richard provides an overview of both unit testing and TDD, explaining why both are crucial for developers. He also shows how to set up your development environment for TDD and goes over the pytest unit-testing framework. Throughout the course, he shares best practices and provides examples and test cases that can help you gain a practical understanding of TTD in Python.

Topics include:

  • What is unit testing?
  • What is test-driven development (TDD)?
  • Setting up your development environment
  • Setting up pytest with Eclipse and PyCharm
  • Working with pytest
  • Assert statements and exceptions
  • Test doubles
  • TDD best practices
Table of Contents

Introduction
1 Welcome

Overview of Test-Driven Development
2 What is unit testing
3 What is test-driven development TDD
4 Example TDD session – The FizzBuzz Kata

Setting Up a Development Environment
5 Python virtual environments
6 Set up pytest in PyCharm
7 Set up pytest in Eclipse PyDev

Pytest Overview
8 Overview of pytest
9 Test discovery
10 An xunit-style setup and teardown
11 Test fixtures
12 Assert statements and exceptions
13 Command line arguments – pytest

The Supermarket Checkout Kata
14 Supermarket Checkout Kata overview
15 Setup and first test case
16 Add items add items prices and calculate current total
17 Add multiple items and calculate total
18 Add and apply discounts
19 Throw exception when adding an item with no price

Test Doubles
20 Test doubles unittest.mock and monkeypatch overview
21 Example – unittest.mock

Test-Driven Development Best Practices
22 TDD best practices

Conclusion
23 Summary