Test protect production code with unittest & nose
Pooja Shah (~p00j4) |
What is in it for me:
This workshop will provide hands-on learning of TDD from the scratch using unittest along with nose in python. We will learn, how to write unit tests and how to make best out of them in order to create a safety net around your code.
Details: Each topic with Q & A inclusive
- Why unit tests, what is it and why should I care? 10 m
- Initial setup 10 m
- Writing Tests basics [ usage of unittests library ] 10 m
- Coverage 10 m
- How to cover most of the code with ease & speed up development & execution:
- Parameterise 10 m
- Mock & patch 10 m
- Mock with Autospec and SideEffect 10 m
Control test run using nose 20 m
- Run/exclude specific test function
- Rerun failed tests only
- Coverage html generation & analysis
- Speed up more with multi process
Test Reporting : beautiful readable reports 10 m
Dont’s: 10 m Some very important internals of nose & unittest which can get clueless if used wrongly, we will discuss about those with the tricks on how to avoid/debug them.
Q & A focused 30 minutes for additional queries which may get left out during the workshop
- Basics of Python
- Has been writing functional code in Python on daily basis.
- Own laptop
- Installed libraries
Note: will try to provide docker image with whole setup instead
Akshay comes with a strong background in Python building various systems for scale. He has built various python applications/tools that support the core at MoEngage and earlier at PayPal. Some of his major contributions have been building an in-memory cache, a python-based structural/contextual log writer, an ORM to build Structured/Unstructured Objects and saving them to any downstream database etc.
Pooja is an automation nerd and open source enthusiast. She loves brainstorming and implementing crazy ideas to figure out ways to improve the product quality. Having a blend of dev, qa & devops mindset, she strives to bridge the gaps between all the teams to attain the best results. Driven by curiosity to learn & share new things everyday, she blogs, speaks & records 'easy to learn' tutorials.