Getting started with Python Unit Tests and TDD to structure your code better

Publié le: 03 mars 2023
sur la chaîne: Python for Everyone
383
20

You understand that unit tests allow you to test the correctness of code and make sure everything keeps working after making changes but many code is hard to test because often, code and tests are written in the wrong order. This causes some code not to be tested at all! In this video I will show you a simple trick that makes writing unit tests much more enjoyable and as a bonus will let you write better code.

C H A P T E R S
0:47 Spot first error by executing code
1:20 The problem with testing coupled code
2:30 Unit test for empty Settings class
3:00 Test failed due to an AttributeError
3:45 Reverse the order of writing code and writing tests
4:00 Write the test first!
4:40 Do not use text files, database or network data in Unit Tests
5:30 You hate tests because your system is coupled
5:50 Useless tests because the business requires test coverage
6:30 Use dependency injection to decouple the code
6:50 SettingStorage objects are now pluggable


M Y O N L I N E T R A I N I N G
🎓Like my style of teaching? Try free chapters of my online courses: https://pythonforeveryone.com

#pythonforeveryone #programming #python


Sur cette page du site, vous pouvez voir la vidéo en ligne Getting started with Python Unit Tests and TDD to structure your code better durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Python for Everyone 03 mars 2023, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 383 fois et il a aimé 20 téléspectateurs. Bon visionnage!