We may earn an affiliate commission when you visit our partners.
Course image
Richard Wells

Test Driven Development is a key discipline every software developer should practice to ensure the quality of their code. In this course I'll show you how to use this discipline in your everyday coding practices to help ensure the quality of your code base.

Read more

Test Driven Development is a key discipline every software developer should practice to ensure the quality of their code. In this course I'll show you how to use this discipline in your everyday coding practices to help ensure the quality of your code base.

  • In this course we’ll be going over:

    • What is Unit Testing and Test Driven Development and how does it help you.

    • What is the PyTest testing library and how is it used for writing unit tests in Python.

    • How to setup some common Python development environments to use PyTest.

    • What are Test Doubles and how do you implement and use them with unittest.mock.

    • What are some Best Practices for unit testing and Test Driven Development.

    • We’ll also walk through some hands on example programming sessions using TDD in Python.

Enroll now

Here's a deal for you

We found an offer that may be relevant to this course.
Save money when you learn. All coupon codes, vouchers, and discounts are applied automatically unless otherwise noted.

What's inside

Learning objectives

  • How to implement unit tests in python using the discipline of test driven development.
  • How to use test doubles to decouple production code from the rest of the system to be tested in isolation.

Syllabus

Introduction

In this video I introduce myself and the concepts of unit testing and Test Driven Development.

In this section we'll discuss what is unit testing, how unit tests are implemented with the discipline of TDD, what the benefits of TDD, and review a working example in python.
Read more

In this lecture we'll go over what unit testing is and why it's so important to the software development process.

In this lecture we'll go over what Test Driven Development is, a little bit of it's history, it's benefits, and it's work flow.

In this lecture I'll show you a short example Test Driven Development coding session using Pytest and implementing the Fizz Buzz Code Kata.

Unit Testing and Test Driven Development Quiz
In this section I'll go over setting up Python Virtual Environments and then setting up several IDEs for Unit Testing and TDD with PyTest.

In this lecture I'll go over the Python virtual environments and why using them is a best practice for all python developers.

In this lecture I walk through setting up and using Pytest with the JetBrains PyCharm IDE.

In this lecture I walk through setting up and using Pytest with Eclipse PyDev IDE.

In this section I'll give an overview of the python unit testing framework PyTest.

In this lecture I'll go over the Pytest Unit Testing framework for Python.

In this lecture I'll go over how PyTest automatically discovers unit tests and provide some examples.

In this lecture we'll go over PyTest's implementation of the class XUnit style of setup and teardown code and go over a few examples.

In this lecture I'll go over what PyTest Test Fixtures are and how to use them.  Then I'll work through some examples.

In this lecture we'll go over how the python assert statement is used in your PyTest unit tests, how to test that exceptions are raised properly, and go work through some examples.

In this lecture I go over some useful PyTest command line arguments and provide some examples.

In this section I'll go over a more complicated example of practicing TDD by implementing the code for adding items and creating a purchase total for a supermarket checkout.

In this lecture I'll go over the Supermarket Checkout Kata which will be the focus of this section.  

In this lecture I create a new PyCharm project for this kata and verify I have PyTest setup correctly.  Then I implement the first test case.

In this lecture I'll implement the 2nd, 3rd, and 4th test cases for the supermarket checkout kata.  Adding item prices, adding items, and calculating the total.

In this lecture I implement the next test case for the supermarket checkout kata where I add multiple items to the checkout list and validate I have the correct total.

In this lecture I add discount rules and applying discounts when calculating the total.

In this lecture I implement the last test case of the supermarket checkout kata.  Generating an exception if an item is added which doesn't have a price defined.

Learn about the different types of test doubles and how they can help with testing pieces of the production code in isolation.

In this lecture I go over what test doubles are and how they help you test your production code in isolation.  Then I'll go over how to use the unittest.mock mocking framework and the PyTest monkeypatch TestFixture for easily implementing test doubles in your tests.

In this lecture I'll work through a hands on TDD coding session with Pytest and unitest.mock for implementing and using test doubles.

Test Doubles Quiz
In this section we'll go over various best practices that will help you with implementing your unit tests and using TDD.

In this lecture I'll go over some unit testing and TDD best practices that I've found essential to getting the full benefit of practicing TDD.

This section contains the conclusion lecture where I'll go over all the things we learned in this course and where to go from here.

In this lecture I wrap up the course by reviewing what we went over in the course and what the next steps are in the path of learning unit testing and Test Driven Development in python

Good to know

Know what's good
, what to watch for
, and possible dealbreakers
Suitable for learners at a beginner level
Offers a comprehensive study of unit testing and test-driven development (TDD) in Python programming
Instructor Richard Wells is recognized for their work in teaching TDD in Python
Students learn to implement unit tests using the PyTest framework in Python
Students develop skills in using test doubles to decouple production code for isolated testing
Course includes hands-on coding sessions using TDD in Python

Save this course

Save Unit Testing and Test Driven Development in Python to your list so you can find it easily later:
Save

Reviews summary

4-star course on unit testing

According to students, this 4-star course on unit testing in Python offers engaging assignments but requires background knowledge. Those who have taken it have praised its easy-to-follow lectures and thorough coverage of the subject matter. However, some have also noted that it can be challenging at times and that it assumes some prior knowledge of the topic.
Assignments can be challenging but rewarding.
"The assignments were challenging, but they helped me to learn the material very well."
Course covers unit testing topics in depth.
"The course covers unit testing in Python very thoroughly."
Course assumes some background in unit testing.
"It is good. But at some places it needed little background overview to keep up with what is getting executed and why we are following such particular process to implement."

Activities

Be better prepared before your course. Deepen your understanding during and after it. Supplement your coursework and achieve mastery of the topics covered in Unit Testing and Test Driven Development in Python with these activities:
Read 'Test-Driven Development with Python'
This book provides a comprehensive guide to Test-Driven Development, including how to write and run unit tests, and how to integrate TDD into your development workflow.
Show steps
  • Read the introduction and the first three chapters.
  • Try some of the exercises in the book.
  • Write a short blog post or article on what you've learned.
Follow a tutorial on TDD with unittest and mock
This activity will help you gain a better understanding of how to use unittest and mock for TDD in Python.
Browse courses on TDD
Show steps
  • Find a tutorial on TDD with unittest and mock.
  • Follow the steps in the tutorial.
  • Write a few unit tests for your own code.
Write unit tests for a small Python script
Writing unit tests is an important part of Test-Driven Development. This activity will help you gain confidence in writing and running unit tests.
Browse courses on Unit Testing
Show steps
  • Choose a small Python script to test.
  • Install the pytest testing framework.
  • Write a few unit tests for your script.
  • Run your tests and debug any errors.
Five other activities
Expand to see all activities and additional details
Show all eight activities
Join a TDD study group
This activity will help you learn from and collaborate with other students in a TDD study group.
Browse courses on TDD
Show steps
  • Find a TDD study group.
  • Attend regular study group meetings.
  • Discuss TDD topics and techniques with other students.
  • Work on TDD projects together.
Create a tutorial on TDD in Python
This activity will help you deepen your understanding of TDD and Python by teaching it to others.
Browse courses on TDD
Show steps
  • Plan the structure of your tutorial.
  • Write the content of your tutorial.
  • Create a video or screencast to accompany your tutorial.
  • Publish your tutorial online.
Develop a small Python application using TDD
This activity will help you apply your TDD skills to a real-world project.
Browse courses on TDD
Show steps
  • Choose a small Python application to develop.
  • Write a test plan for your application.
  • Write the code for your application.
  • Debug your application and fix any bugs.
  • Document your application.
  • Deploy your application.
Contribute to a Python TDD project on GitHub
This activity will help you learn about open source development and contribute to a real-world Python TDD project.
Browse courses on TDD
Show steps
  • Find a Python TDD project on GitHub.
  • Fork the project and make a clone of it.
  • Make changes to the project.
  • Create a pull request.
  • Respond to feedback from the project maintainers.
  • Get your changes merged into the main branch.
Mentor a junior developer in TDD
This activity will help you solidify your understanding of TDD by teaching it to someone else.
Browse courses on TDD
Show steps
  • Find a junior developer who is interested in learning about TDD.
  • Set up regular mentoring sessions.
  • Teach the junior developer about TDD concepts and techniques.
  • Help the junior developer write TDD tests.
  • Provide feedback on the junior developer's work.

Career center

Learners who complete Unit Testing and Test Driven Development in Python will develop knowledge and skills that may be useful to these careers:
Software Developer
Unit testing and test driven development are essential skills for any software developer. This course will teach you how to use these techniques to improve the quality of your code. You will learn how to write unit tests, how to use test doubles, and how to implement test driven development in your own projects. This course will help you become a more productive and efficient developer.
Test Engineer
Unit testing and test driven development are essential skills for any test engineer. This course will teach you how to use these techniques to improve the quality of your tests. You will learn how to write unit tests, how to use test doubles, and how to implement test driven development in your own projects. This course will help you become a more productive and efficient test engineer.
Quality Assurance Analyst
Unit testing and test driven development are essential skills for any quality assurance analyst. This course will teach you how to use these techniques to improve the quality of your software. You will learn how to write unit tests, how to use test doubles, and how to implement test driven development in your own projects. This course will help you become a more productive and efficient quality assurance analyst.
Software Architect
Unit testing and test driven development are essential skills for any software architect. This course will teach you how to use these techniques to improve the design of your software. You will learn how to write unit tests, how to use test doubles, and how to implement test driven development in your own projects. This course will help you become a more productive and efficient software architect.
Software Engineer
Unit testing and test driven development are essential skills for any software engineer. This course will teach you how to use these techniques to improve the quality of your code. You will learn how to write unit tests, how to use test doubles, and how to implement test driven development in your own projects. This course will help you become a more productive and efficient engineer.
Technical Project Manager
Unit testing and test driven development are essential skills for any technical project manager. This course will teach you how to use these techniques to improve the quality of your software projects. You will learn how to write unit tests, how to use test doubles, and how to implement test driven development in your own projects. This course will help you become a more productive and efficient technical project manager.
DevOps Engineer
Unit testing and test driven development are essential skills for any DevOps engineer. This course will teach you how to use these techniques to improve the quality of your software delivery process. You will learn how to write unit tests, how to use test doubles, and how to implement test driven development in your own projects. This course will help you become a more productive and efficient DevOps engineer.
Business Analyst
Unit testing and test driven development are essential skills for any business analyst who wants to understand the technical aspects of software development. This course will teach you how to use these techniques to improve your understanding of software requirements. You will learn how to write unit tests, how to use test doubles, and how to implement test driven development in your own projects. This course will help you become a more productive and efficient business analyst.
Technical Writer
Unit testing and test driven development are essential skills for any technical writer who wants to write accurate and informative documentation for software products. This course will teach you how to use these techniques to improve the quality of your documentation. You will learn how to write unit tests, how to use test doubles, and how to implement test driven development in your own projects. This course will help you become a more productive and efficient technical writer.
Product Manager
Unit testing and test driven development are essential skills for any product manager who wants to build high-quality software products. This course will teach you how to use these techniques to improve the quality of your software products. You will learn how to write unit tests, how to use test doubles, and how to implement test driven development in your own projects. This course will help you become a more productive and efficient product manager.
Educator
Unit testing and test driven development are essential skills for any educator who wants to teach software development. This course will teach you how to use these techniques to improve the quality of your teaching. You will learn how to write unit tests, how to use test doubles, and how to implement test driven development in your own projects. This course will help you become a more productive and efficient educator.
Data Scientist
Unit testing and test driven development are essential skills for any data scientist who wants to develop high-quality data products. This course will teach you how to use these techniques to improve the quality of your data products. You will learn how to write unit tests, how to use test doubles, and how to implement test driven development in your own projects. This course will help you become a more productive and efficient data scientist.
Machine Learning Engineer
Unit testing and test driven development are essential skills for any machine learning engineer who wants to develop high-quality machine learning models. This course will teach you how to use these techniques to improve the quality of your machine learning models. You will learn how to write unit tests, how to use test doubles, and how to implement test driven development in your own projects. This course will help you become a more productive and efficient machine learning engineer.
Data Analyst
Unit testing and test driven development may be useful for any data analyst who wants to develop high-quality data products. This course will teach you how to use these techniques to improve the quality of your data products. You will learn how to write unit tests, how to use test doubles, and how to implement test driven development in your own projects. This course may help you become a more productive and efficient data analyst if you're particularly interested in applying testing and driven development approaches to your work.
Statistician
Unit testing and test driven development may be useful for any statistician who wants to develop high-quality statistical models. This course will teach you how to use these techniques to improve the quality of your statistical models. You will learn how to write unit tests, how to use test doubles, and how to implement test driven development in your own projects. This course may help you become a more productive and efficient statistician if you're particularly interested in applying testing and driven development approaches to your work.

Reading list

We've selected 13 books that we think will supplement your learning. Use these to develop background knowledge, enrich your coursework, and gain a deeper understanding of the topics covered in Unit Testing and Test Driven Development in Python.
Classic guide to unit testing. It covers the principles of unit testing, as well as practical advice on how to write effective unit tests. This book would be a valuable resource for anyone looking to improve their unit testing skills.
Practical guide to unit testing with pytest. It covers the basics of pytest, as well as more advanced topics such as fixtures and parametrization. This book would be a valuable resource for anyone looking to learn more about pytest.
Covers all the basics of Test-Driven Development in an easy-to-understand manner. Well-written and full of useful examples.
Classic guide to writing testable code. It covers the principles of testable design, as well as practical advice on how to write code that is easy to test. This book would be a valuable resource for anyone looking to improve their code quality.
Classic guide to writing clean code. It covers the principles of clean code, as well as practical advice on how to write code that is easy to read, maintain, and reuse. This book would be a valuable resource for anyone looking to improve their code quality.
Classic guide to design patterns. It covers the principles of design patterns, as well as a catalog of common design patterns. This book would be a valuable resource for anyone looking to improve their software design skills.
More accessible guide to design patterns. It uses a conversational style and lots of diagrams to explain the principles of design patterns. This book would be a valuable resource for anyone looking to learn more about design patterns in a more engaging way.
Classic guide to test-driven development (TDD). It covers the principles of TDD, as well as practical advice on how to implement TDD in your own projects. This book would be a valuable resource for anyone looking to learn more about TDD.
Guide to growing object-oriented software. It covers the principles of TDD, as well as practical advice on how to refactor test code efficiently.
Guide to professional software development. It covers the principles of clean code, as well as practical advice on how to write code that is easy to read, maintain, and reuse.
Guide to agile testing. It covers the principles of agile testing, as well as practical advice on how to implement agile testing in your own projects.
Guide to behavior-driven development (BDD). It covers the principles of BDD, as well as practical advice on how to implement BDD in your own projects.

Share

Help others find this course page by sharing it with your friends and followers:

Similar courses

Here are nine courses similar to Unit Testing and Test Driven Development in Python.
What Is TDD and Why It Is Not Unit Testing: Executive...
Most relevant
Introduction to Test and Behavior Driven Development
Most relevant
TDD as a Design Tool
Most relevant
Unit Testing Swift Mobile App
Most relevant
Learn Unit Testing with NUnit and C#
Most relevant
Unit Testing Dotnet (.NET) Application with xUnit .net &...
Most relevant
WPF and MVVM: Test Driven Development of ViewModels
Most relevant
TDD with JUnit 5
Most relevant
Test and Behavior Driven Development (TDD/BDD)
Most relevant
Our mission

OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.

Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.

Find this site helpful? Tell a friend about us.

Affiliate disclosure

We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.

Your purchases help us maintain our catalog and keep our servers humming without ads.

Thank you for supporting OpenCourser.

© 2016 - 2024 OpenCourser