Increase test coverage with each code push; no more cry on legacy code with a simple utility
In order to get confidence in release, one feedback report plays vital role: Test Coverage Report
Many of us practice test driven development or at-least write the test code after the main code, and pride ourselves in our code coverage. This is relatively easy to do when you begin a new project, but what happens when you take over an existing codebase with little to no tests?
Have you encountered questions like:
- Most of this is legacy code hence not writing tests and gradually the test coverage decreases?
- This is not my code, why should I write tests or maintain tests for it?
- Where and how do you start writing tests? This task can be very intimidating and frustrating.
Team halts on going development and covers whole legacy codebase.
And then the Real Life happens:
Due to the timelines and priorities this doesn’t seem feasible and the amount of refactoring required to cover legacy code is something a new team member would not be interested in doing.
How do we find the middle practical ground
Well, yes we had the same problem, and everytime we merged new code, we decreased the overall coverage.
That’s where we came up with a simple approach which we named “Shield” which shields the newly added code not going into the system without the coverage.
In this talk, we will see how shield solves it and the “Legacy code …” songs are stopped.
Will also demonstrate how shield works, how can you also create shield for your own context.
- How do you deal with legacy code when wanting to improve the test coverage?
- What approaches can help
- Why does our current approach work
- How can you create your own
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
- Previous session:
- A bot to solve communication problems: https://youtu.be/VrJgioOtX8c?t=1m45s