• 10 hours
  • Medium

Free online content available in this course.

course.header.alt.is_video

course.header.alt.is_certifying

Got it!

Last updated on 8/30/22

Get the Most out of This Course

Welcome to This Course

In this course, we’re going to create some tests for pre-existing projects. These projects are currently very simple, but may need to change in the future. Adding complexity to a project increases the risk of bugs, and this is where testing can come in really useful.

How does testing reduce the risk of bugs?

Well, quite simply, each test will help you to work out which part of your application has a problem. Your testing will also allow you to check whether any new functionality added to one part of the application will cause a problem in another part. This can be a real time-saver if a problem arises.

Understand IT Testing

When you create a new project, one way to check whether your code is working correctly is to simply run your program, and see if it behaves correctly. You consider the programming work to be complete once all of the required functionality is in place.

But we developers can be quite lazy. We like to create programs to automate the things we don’t like doing so we can spend more time on the things we enjoy. What could be more tedious than manually testing a program’s functionality? There is a limit to this kind of testing, because manual checking doesn’t enable you to verify that your program’s internal logic is working correctly.

This is why many programming languages include the option of testing programs automatically. Essentially, what we’re going to do is create a script alongside our program, whose sole purpose will be to carry out the testing that we don’t want to do manually.

There are many advantages to this approach. We’ve already talked about the time-saving aspect. But in addition to this, a really good set of tests improves collaboration between developers and assists when adding new functionality. You don’t need to worry about “breaking” existing functionality. The tests will tell you straight away if there’s a problem.

In this course, we’ll work together on designing a test plan and coding the tests in Python. We have a lot to get through!

Familiarize Yourself With the Course Projects

In the first part of this course, we’ll see how to add unit tests to existing projects using the Pytest test framework.

In the second part, we’ll build some mock objects to simulate the behavior of classes and functions, and we’ll see how to test projects built using the Flask and Django frameworks.

In the third part, we’ll refine our unit tests by setting up fixtures and test classes. We’ll also see how to check code coverage so that we can measure how thorough the testing is.

In the fourth and final part, we’ll create some integration and functional tests. We’ll then add some performance tests to our project, using the Locust framework, and we’ll discover the benefits of using a Test-Driven Development methodology when adding new functionality.

You’ll get the chance to improve the projects as we go through the course, incorporating the new concepts from each chapter. 

Don’t worry, we’ll suggest ideas for improvement as we go along.

Are you excited?

Where to Find the Course Code

Throughout this course, you’ll be working on three projects so that you can put the theory into practice as you work through the chapters. To begin with, you’ll work on a pure Python project with no framework, then on two further projects using Flask and Django. Below are links to the GitHub repositories for each project:

Right, let’s start exploring the wonderful world of testing!

Example of certificate of achievement
Example of certificate of achievement