Python Unit Testing: Testing Python Code Using pytest


Overview/Description
Expected Duration
Lesson Objectives
Course Number
Expertise Level



Overview/Description

Explore several types of testing frameworks for Python applications, including the unittest framework, pytest, and doctest, in this 12-video course. First, you will learn how to define and run tests, and how to streamline tests by using fixtures. You will learn the important features of the pytest framework to create small test units, and to define and run individual tests. Next, you will learn to group tests into multiple scripts, and how to execute multiple test scripts within a single run. Learners will observe how to create a simple test, and learn to increase the complexity by defining test scripts to cover multiple tests for your application. You will explore the execution and skipping of specific tests in scripts, then learn to simplify tests by using parameterization. You will learn how to apply filters on different tests, and to execute tests with a certain string in the test name, and examine the use of markers in a test. Finally, you will learn how to use fixtures to run operations common to multiple tests.



Expected Duration (hours)
1.2

Lesson Objectives

Python Unit Testing: Testing Python Code Using pytest

  • discover the key concepts covered in this course
  • write and execute a test using pytest
  • execute tests defined in multiple scripts using pytest
  • pick the tests to execute based on the test function names
  • stop the execution of tests when there are a specific number of test failures
  • apply markers to tests and run only those tests which contain specific marker, and skip the execution of specific tests unconditionally
  • debug test scripts using the python debugger
  • parametrize calls to a function an application using the pytest parametrize decorator
  • use fixtures to define common operations for test functions
  • apply module and function level scopes for fixtures functions
  • bundle fixture functions which are shared across scripts within a single conftest.py file
  • summarize the key concepts covered in this course
  • Course Number:
    it_pyutpydj_03_enus

    Expertise Level
    Intermediate