Unit Testing Tutorial - 4 | THE RIGHT WAY to Use Pytest for Webservice Testing

preview_player
Показать описание
Unit Testing Tutorial - 4 | THE RIGHT WAY to Use Pytest for Webservice Testing. In this python unit testing tutorial I show you the right way to use pytest for testing a flask webservice.
To make unit testing more easy is to first separate the concerns. This way we can use pytest to unit test the business logic of this flask webservice. Pytest has functionality for unit testing exception handling, which I will demonstrate in this unit testing tutorial. Also Pytest plays very well with the unittest module from the python std library and I will show you how to get rid of external dependencies with this combination.

00:00 Intro
03:53 Refactoring webservice
09:16 Testing exceptions in pytest
14:28 Testing logic
19:25 Getting rid of external dependencies
30:46 Outro

Unit Testing Tutorial - 1 | Why you should use Unit Testing

Unit Testing Tutorial - 2 | Unit Testing in Data Science and Data Engineering

Unit Testing Tutorial - 3 | Setup Pytest And Write Unit Tests

_All social media________________________

_About the channel______________________

Awesome Data science without much math and everything you need to know to deploy your machine learning models!
--
All videos will be easy to follow and I'll try to reduce the complicated mathematical stuff to a minimum because I believe that you don't need to know how a CPU works to be able to operate a PC...

_Equipment ____________________________

#unittesting #pytest #unittestsolution #softwaretesting #datascience #machinelearning #DataEngineering #datascience #DataScience #DataEngineer
Рекомендации по теме
Комментарии
Автор

Hi Johannes, thank you very much for this amazing series on unit testing! I am an Applied Scientist and I find this super useful. I have a question:
The purpose of unit testing seems to be testing each function we write when isolated from any other dependencies, just to check if our logic is correct. Does this mean that testing this once is enough. Because even if we add new functions to our code base, the unit tests for the ones we already completed would not change. Unless we modify the existing methods as well.
Is this understanding right?
And if we want to check if my existing functions are still working properly with the new function additions, then we need to resort to other sorts of testing like regression which you mentioned.
If we happen to modify our existing methods, then we will need to rewrite our unit tests.

Please let me know your thoughts

sateeshsivakoti