Python for Testing 102 (PT102)

This course is the second in the Testing Essentials series, designed to prepare you for the PCAT™ – Certified Associate Tester with Python certification exam.

The Python for Testing 102 (PT102) is a hands-on, project-driven continuation of PT101. Across this course you’ll deepen your testing practice with both unittest and pytest, level up your use of fixtures and parameterization, mock external dependencies cleanly, and round it out with TDD and BDD.

You will learn

  • Grow a single project end-to-end – continue the Crossword Helper and evolve it (palindromes → ROT shifts → anagrams → pattern matching) with tests that guide the design.
  • Strengthen your unittest toolkit – apply test anatomy and F.I.R.S.T., write precise assertions ( assertEqual, assertAlmostEqual, assertRaises, assertCountEqual), remove duplication with setUp/tearDown and class/module hooks, use subTest(), and control runs with @skip/@expectedFailure.
  • Adopt pytest for speed and clarity – native assert with rich introspection, reusable fixtures (including yield cleanup) and scopes (function → session), parameterization with @pytest.mark.parametrize, markers ( skip/xfail/importorskip), targeted selection ( -k/-m), verbosity and reports ( -v, -r), and centralized config in pytest.ini.
  • Mock with confidence – replace slow/fragile I/O using unittest.mock (stubs/fakes/spies, Mock/MagicMock, patch with spec/create_autospec) and the pytest-mock mocker fixture ("mock where it’s used").
  • Measure and report – generate coverage with pytest-cov and share results via pytest-html (including self-contained reports).
  • TDD & BDD – practice Red → Green → Refactor on small slices (and refactor safely with Pythonic improvements like zip()), then describe behavior with Gherkin (Feature/Scenario, Given/When/Then) and bind to Python step definitions (e.g., behave).

Whether you’ve just finished PT101 or bring equivalent experience, PT102 takes you from solid basics to confident, real-world Python testing.


Course Syllabus

Context managers for safe setup and teardown, Decorators for logging, timing, and instrumentation, Instance, class, and static methods for flexible test utilities, Module Project & Assessment

Why unit testing matters, Test structure and naming conventions, The F.I.R.S.T. principles of effective tests, Writing and running tests with unittest, Module Project & Assessment

Common assertion patterns and best practices, Error handling and exceptional cases, Numeric comparisons and tolerance with floats, Anagram and string-manipulation tests, AAA pattern and clean test design, Module Project & Assessment

Using setUp, tearDown, and class-level fixtures, Parameterizing tests with subTest(), Test filtering and markers, Mocking external services with unittest.mock, Module Project & Assessment

Why unit testing matters, Test structure and naming conventions, The F.I.R.S.T. principles of effective tests, Writing and running tests with unittest, Module Project & Assessment

The TDD cycle and practical examples, Refactoring safely with tests, BDD basics and Gherkin, Step definitions with behave, Module Project & Assessment

Certification

The PCAT™ – Certified Associate Tester with Python certification is a Python Institute's Testing specialization track credential that covers the most important elements of automated testing activities from the perspective of a Python programmer. The exam covers the principles of software testing, the fundamentals of unit testing, the principles of software engineering, software decomposition, and the Test-Driven and Behavior-Driven Development (TDD, BDD) approaches to programming.

The PCAT certification gives its holders confidence in their software testing and programming skills, helps them stand out in the job market, and gives them a head start on preparing for and advancing to the professional level.

  • Channel: Edube Interactive
  • Sponsor: Python Institute
  • Mode: Online self-study course
  • Level: Intermediate
  • Cost: Standard (Free), Premium (Paid)
  • Study Time: 30-40 hours (Recommended: 5-7h/week)
  • Language: English
  • Associated Certification: PCAT – Certified Associate Tester with Python
Buy Exam Voucher
Associated courses

Python for Testing 101 (PT101) (Beginner +)

Pre-requisites

PCEP certification, Python Essentials 1, or equivalent experience