Test protect production code with unittest & nose

Pooja Shah (~p00j4)


5

Votes

Description:

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

Prerequisites:

  • Basics of Python
  • Has been writing functional code in Python on daily basis.
  • Own laptop
  • Installed libraries
    • python==2.7
    • coverage==4.1
    • nose==1.3.7
    • nose-parallel==0.2.0
    • nose-parameterized==0.5.0
    • nose-xunitmp==0.4.0
    • nosexcover==1.0.10
    • goober==0.1.4

Note: will try to provide docker image with whole setup instead

Content URLs:

Speaker Info:

Akshay Goel

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 Shah

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.

Speaker Links:

Pooja

Akshay

Section: Testing
Type: Workshops
Target Audience: Beginner
Last Updated: