Writing unit tests: It's now or never!
Submitted by Pooja Shah (@p00j4) on Sunday, 4 March 2018
New to unit testing? Or You want to adopt unit testing and would like to avoid common pitfalls.
This workshop is aimed at people who would like to improve their development skills by practially learning to write professional quality code.
Modifying production code without unit test cases is similar to walking through a field of landmines and writing and maintaining good unit tests can be real hard work, hence in this workshop, where instead of just covering the syntax, we will introduce most of tips and tricks to write good UnitTests with ease as we build the code together.
This workshop will help you to adopt unit testing if:
- You spend a lot of non-billable hours fixing bugs
- You and your team have adopted unit tests, but now you feel that
- The tests are slowing you down
- Having practical, good coverage is real hard
- You want to adopt unit testing and would like to avoid common pitfalls
- Your application is huge and developers cannot modify it fast enough.
Who Should Attend
Anyone who wants to write safer code Eg. Developers using Python and would like to learn how to avoid introducing mistakes in their software.
Each section goes with understanding and trying out each one hands-on.
- Why unit tests, what is it and why should I care ? 10 m
- Getting Started 40 m
- Setup checks
- Unit Testing basics
- Writing Simple Unit Tests
- Organising with setup and teardown
- How to cover most of the code with ease & speed up development & execution
- Parameterise 10 m
- Isolating Dependencies with Mocks
- Mock & various ways of using patch 20 m
- Mock with Autospec and SideEffect 20 m
- Managing test Execution 20 m
- Run specific tests
- Re-run only failed tests
- Speed up more with multi process
- Are these tests bringing value 20 m
- Test Reports
- Coverage Reports
Next Pointers and Resources 10 m
What Unit Testing is Not 10 m
Dont’s 10 m
Will work on few frequent typical mistakes which usually we do & tricks on how to avoid them
Q & A 30 m
We together will work on your problems and queries
note: Total 4 hours with 10 minutes break in between
- Should be familiar with basic coding with Python.
- Please bring you own laptop with python 2.7 or above installed
- Detailed setup instructions will be emailed a week before the workshop day
Akshay is a programming standards enthusiast and he comes with a strong background in Python and Java building various systems for scale earlier for Paypal and now MoEngage. He tries to make writing production-grade code as easy as a breeze for anyone and everyone. As Technical Architect at MoEngage, making systems (distributed obviously) dance to his tune is something he enjoys. 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. Outside of work, he enjoys food and listening to music. He plays badminton regularly and loves competing there.
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 every day, she pens them, open-source, record tutorials and talk about them at relevant conferences, some of the glimpses can be found on youtube as well.
With the help of some of her loving friends, she now has a special colleague named alice, a talking bot she has created to help herself in work & gain her free time to play Pokemon