Python 08: Clean Test Python
Unit Test, Pytest and doctest practical course for python programmers

You want to write structured and high-quality unit tests for your Python code? You want to test databases, foreign APIs and foreign code? You want to recognize bad and useless unit tests and PyTests right away and turn them into good unit tests using proven patterns? You finally want to know how Test-Driven-Development looks like in practice and how you can use TDD in a reasonable way? Then look no further. The Python Unit Testing Practical Seminar is ideal for all Python programmers who want to learn Unit Testing, PyTest and Doctest in an efficient and practical way using clear examples and tasks, so that they can test Python code cleanly and improve it significantly. Learn more about this Unit Test practical seminar...


  • Quick and effective introduction to Unit Test, Pytest and Doctest
  • Practical introduction to Test-Driven-Development (TDD)
  • Best practices for Testable Design, Clean Test and Test Smell
  • Advanced techniques such as Test Double
  • Significantly improve code quality through good testing

By means of many examples and exercises you will learn the most important Python testing frameworks (Unit Test & Pytest) as well as advanced techniques like TDD from a practical point of view and how you can use them successfully in your current project. You will also learn and apply golden rules for clean testing and code. You will improve the quality and the goodness of your Python production code and shorten the development time.

Course formats



Live oder online large

Teaching material



Video clips


Live oder online large

Teaching material



Snacks large


Online large

Teaching material



Video clips

All courses also include unlimited access to our member area with many more videos, tutorials and information about coding.


The course covers a selection of the following topics:

  • Test Structure
  • Name Conversion
  • Test Lifecycle
  • Test Data
  • Features von pytest
  • Exceptions in pytest
  • unittest
  • Test with Fixtures
  • Parameterized Test
  • Test Double
  • doctest
  • Test-Driven-Development
  • Test Smells Catalog
  • Test Readability
  • Test Maintainability
  • Test Trustworthiness

For more details, please see the agenda below.


The Unit Test in Python seminar at the Munich Coding Academy is aimed at programmers with basic Python knowledge, comparable to our Python for programmers course. It does not require any knowledge of old unit testing versions.

  • Individuell: wir gehen gezielt auf Dich ein und berücksichtigen Deine Vorkenntnisse, Wunschthemen und Schwerpunkte

  • Strukturiert und leicht verständlich

  • Bringe deine Karriere, Studium oder Ausbildung auf die nächste Stufe: mit Zertifikat

  • Sicher und eigenständig Programme entwickeln (ob privat, beruflich oder für dein Startup)

  • Viel, viel, viel Praxis: sofort anwendbare Ergebnisse

  • kleine Gruppen: max. 8 Teilnehmer im 3-Tages-Kurs max. 15 Teilnehmer im Online-Coaching

  • Von Experten nach der Raed- Methode® entwickelt & auf die Anforderungen von Tech-Unternehmen im Jahr 2020 ausgerichtet

  • E-Mail-Support auch nach Ende des Kurses


This three-day course provides an introduction and deep dive into testing Python code. The course is intended for users with prior experience in Python who want to develop a better understanding of testing their own code against failures and regressions, and of improving the test coverage of existing code bases. The participants get instructive problems to solve using the newly learned techniques. 

-Why should I test my code?

-How can tests help in pinpointing problems?

-What makes a good test and how can I write it?

-How can I test code with external dependencies?

-How can I avoid them?

-How can I avoid writing (too much) test code?

-How can I keep my test suite maintainable in the future?

-When and why would I use “unittest”, “pytest” or “doctest”?

What do you learn on the first day?

You will learn how to write your first unit testing program in Python. We start slowly and look at the should/actual principle of testing frameworks. You learn how the test structure should look like, how you should name your test methods and how you can find the test data. The equivalence classes and boundary value techniques are suitable for this. You master the syntax and semantics of Unit Test and PyTest. After this day, you will be able to write and use good unit tests for your Python code.

What do you learn on the second day?

On the second day you learn more advanced techniques with Pytest, Unit Test and doctest. For example, you learn how to test database and third-party APIs by simulating their code. This is what the Test Double technique is for. Test Double is a collective term for 5 techniques: Dummy, Fake, Stub, Spy and Mock. You will learn how to use these techniques with the Python test frameworks.

What do you learn on the third day?

The last Unit Testing training with Java is about how to write good tests. Here you will learn the SOLID principles for testable design. Then we look at the Test-Driven-Development (TDD) technique. TDD implements the "Test First: Test code before Production code" method. 

TDD slows down the development speed at the beginning, but later on it catches up massively in speed and is definitely more advantageous than writing the tests afterwards. After all, Clean Code is largely based on writing unit tests before production code, so you have to think about the production code in a fundamental way! You will also learn the important rules for writing meaningful and good tests and the best practices. This will help you recognise the so-called "test smells". 

Test smells is a term for bad tests that bring more disadvantages than advantages. There is a long catalogue for this, which divides the test smells into 3 categories and in each category there are several test smells cases. We look at the most important test smells cases.


The Unit Test course for Python programmers is conducted by one of the following trainers:


Of course, you will receive a certificate as a participant in the Python Unit Test Course for Programmers. The prerequisite for this is the complete participation in all course units and programming tasks and the successful programming of a small final project. However, this will be more fun than stressful for you after this intensive unit testing course.


The agenda is written in English due to the numerous technical terms. Descriptions and course material are in German. You can book the course either in German or English.

All seminar contents are individually adapted to the wishes of our participants. They can vary depending on the level of knowledge and will be defined together with the seminar leader on day 1. In this Python unit test seminar you can choose from the following topics:

Python Unit Testing Day 1


  • Test Motivation
  • Test Frameworks
  • pytest
  • unittest
  • doctest

Generic Rules:

  • Test Structure
  • Test Life Cyce
  • The AAA-Rule
  • Name Conversions
  • Test Data
  • Happy Path
  • Exception Path
  • Equivalence classes
  • Test Strategy


  • install pytest
  • Your first pytest
  • assert statement
  • failed test
  • pytest features
  • Expected exceptions
  • Marking test methods
  • Selection of test methods
  • Tests with error handling


  • what is fixture?
  • Reuse of fixture
  • Multiple fixtures
  • Scope of fixtures
  • predefined fixtures


  • xUnit-Framework
  • unittest
  • Fixtures
  • Test Cases
  • Test Suites
  • Why pytst over unittest?

Python Unit Testing Day 2

Test Double

  • Motivation
  • Testing Database?
  • Dummy
  • Fake
  • Stub
  • Spy
  • Mock


  • why doctest?
  • Executable documentation
  • Executable specification
  • pytst vs. unites vs. doctest

Python Unit Testing Day 3

Test Driven Development

  • Motivation
  • RED
  • Baby Steps
  • TDD Advantages

Testable Design

  • SOLID Principle
  • Single Responsibility
  • Open Close
  • Liskov Substitution
  • Interface Segregation
  • Dependency Inversion

Clean Test

  • Clean Test Rules
  • Test Readability
  • Test Maintainability
  • Test Trustworthiness
  • Test Smells Catalog

Course formats / dates

1 Day Crash Course

In München oder Online

3 Days Course

In München oder Online


Participation possible at any time

4-Wochen-Training copy

Participation possible at any time

For teams

Are you interested in a course for your team? Get in touch - we will find a perfect solution. Our professionals are also happy to come to you. Among other things, we offer:

  • In-house training
  • Technical coaching
  • Consulting
Request Request

Questions & Service

Our service team will be happy to advise you personally. Mon-Fri from 9.00 to 18.00 under:
+49 89 17958-820


BMW Apple Draeger VW Sky Siemens 2000px TÜ V Süd Logo Agfa Kopie Samsung Fraunhofer Valtech Deutsche Bank
Course Catalogue Overview of rocket courses: