hands-on lab
Python: Introduction to Unittest
Difficulty: Intermediate
Duration: Up to 2 hours
Students: 192
Rating: 5/5
Get guided in a real environmentPractice with a step-by-step scenario in a real, provisioned environment.
Learn and validateUse validations to check your solutions every step of the way.
See resultsTrack your knowledge and monitor your progress.
Description
Python's built-in unittest module is a testing framework for creating unit and integration tests.
The unittest module is worth learning because it's built into Python's standard library. Making it accessible without adding third-party dependencies.
This lab introduces the unittest module through hands-on learning.
Learning Objectives
Explore the fundamental building blocks of the unittest module.
At the end of this lab you'll be familiar with:
- Test cases
- Test methods
- Assertion methods
- Test runner
Intended Audience
- Python Developers
Prerequisites
- Familiarity with the Python runtime
- Familiarity with the Python language syntax
- Familiarity with callables
- Familiarity with classes
Updates
July 17th, 2023 - Updated instructions to reflect version change
April 19th, 2023 - Updated theia to include autosave
Covered topics
Lab steps
Web IDE Review
Introduction to Unittest
Test Runner: Main
Test Runner: CLI
Test Runner: Discovery
Test Cases
Test Cases: Assertions
Test Cases: Setup/Teardown
Test Cases: Skip Tests
Test Failures
Summary