06. Testing

Introduction to testing concepts and automated unit testing.

Testing is integral to all forms of engineering. Software developers often write as much test code as they do product code! This set of labs introduces testing concepts and automated testing.


Assertions

The building block of testing.

Unit testing

Using assertions to test a file.

Structuring test code

Organizing the test code has benefits, just like organizing program code.

Control Flow Graphs

A simple but powerful analysis technique for understanding execution paths through source code.

pytest

Use a test framework, pytest, to run tests and collect results.

Testing for exceptions

How to test for expected exceptions.

Test coverage

Computing an objective measure of test quality.

Last modified February 7, 2025.