Elevator Pitch
We all know that we need to write tests, some of you may even practice test-driven development. Pytest provides lots of tools for you to write better tests, however, not all of them we are familiar with. Let’s revisit them and see how they can be used to write better tests.
Description
In this talk, we will visit some valuable tools in Pytest, for example, parameterize, fixture and xfail. All of them provided what problem these tool is trying to solve, an example use case and an example code. The talk will be conducted in a storytelling kind of way, with an example project and writing a test suit to test different features in the project. The goal of this talk is to give beginner code a head start in improving their ability to write meaningful and complex tests.
This talk is for beginner programmers and data scientists who can write Python code and know the basics of testing but have yet to get their hands dirty in writing complex tests that, for example, involve an external application, which will require extra tools from Pytest to achieve that.
Outline
- Introduction and showing an example project (5 mins)
- Using parameterize - what is the problem and how it solve it (5 mins)
- Using fixture - what is a fixture and how can it be used - with example (10 mins)
- Skipping and marking xfail for tests - why and how to do so (5 mins)
- Conclusion (5 mins)