- What is unit testing?
- What is test-driven development (TDD)?
- Setting up your development environment
- Setting up pytest with Eclipse and PyCharm
- Working with pytest
- Assert statements and exceptions
- Test doubles
- TDD best practices
Skill Level Beginner
- [Narrator] Hi, my name is Rich Wells, and I've been a software developer for over 20 years, and in that time I found that trying to keep my code base clean from bugs is a never ending effort. Having a buggy code base causes lots of problems. It can affect your schedule. Some portion of your development team has to stop new future development to go back and fix critical bugs. It can slow down development in general, as developers will be more weary to make changes when they are working in a buggy and brittle code base.
And it can erode your customer's confidence. Both because they are experiencing the bugs and because of your slip schedule on new features while you're fixing those bugs. So what can you as a software developer do to eliminate as many bugs as possible in your code before it gets released? You need to have a multi layered safety net of tests in place that will catch any bugs that might get introduced. And the first layer of this safety net should be a sweep of automated unit tests. Units test verify your code at the level of functions and classes.
They perform positive and negative test cases at the lowest level of your code. Every line of your production code should have an associated unit test that verifies it's working as expected. Test driven development, or TDD, is a practice of writing unit tests before you write your production code. This is backwards to the way most developers write code but it has many benefits. You know every line of production code is working as soon as it's written, because you're testing it immediately. If there is a problem it's easy to track down as you've only written a small amount of code since the last test executed.
And TDD gives you and your team confidence to change the code as you'll know immediately if anything has gotten broken by any particular code change. So how do you go about practicing test driven development? My online course on unit testing and test driven development in Python will take you step by step through the basics of what the principles of TDD are, where TDD came from, and how TDD is practiced with the Python programming language. I also go through several sample coding sessions so you can see how TDD works in action, and I go over TDD concerns and best practices.
The link to my online course is in the description below. Feel free to message me with any questions you may have and I hope you enjoy the course.