From the course: Unit Testing in Python

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Happy path testing

Happy path testing - Python Tutorial

From the course: Unit Testing in Python

Start my 1-month free trial

Happy path testing

- [Instructor] Now that you've seen how to test for expected and unexpected behavior with assertions and exceptions, we should begin thinking about how to structure out test in a way that helps us show which behaviors are intended, and which unexpected ones our system should guard against. This will help you and other developers gain a clear idea of what behaviors your system should carry out. It will also help you focus on creating code that is straightforward to use since you'll be the first person utilizing it in your test. While it may be tempting to lump both tests to show how positive and negative behaviors are handled into the same test function, we should separate this logic. We can do this by creating one test function that displays a happy path test for positive test behaviors. A separate function should show the function sad path for negative case that we'd like to validate against. Either guarding…

Contents