Unit Testing like a Pro – The Circle of Purity
Victor Rentea is one of the top Technical Trainers in Romania. He trained and coached more than 1000 developers of 30+ companies over the 6 years of his training activity. At IBM, even though they call him a Lead Architect, he writes code each day: he’s maniac about Clean Code, so expect seeing some hard-core refactoring. Victor is a key community member: organized the largest 3 Bucharest Java User Group meetups in history. In 2018 he founded the Bucharest Software Craftsmanship Community in which he runs open sessions about clean code, refactoring, pair programming and TDD. He posts daily on LinkedIN and Twitter thoughts about culture, technical excellence and Software Craftsmanship. Victor is now regularly invited to speak at major international conferences (30+ talks until now, #2 best at Devoxx Belgium 2018). His live-coding sessions are insane, lightning-fast but well crafted, full of enthusiasm, deep insights and take-away tips. Things that he learned the hard way during his 14 years of experience. You can find out more about him on victorrentea.ro
Being able to focus on the fun creative part without any fear can make development very addictive. Extensive unit tests can buy you that! However, unit test code is still code, lots and lots of it, if done right. And it has to be maintained just like any other code.
Test code can be 3x times larger than the prod code, so if your tests are not maintainable they will end up slowing you down and causing you painful headaches, compilation errors and spurious failures. To avoid that, your unit tests should be significant; expressive; clean; DRY; non-overlapping; and blazing fast. They are hard to write. And they have principles you need to follow. Principles that will end up shaping the way you design your production code itself. And then it will be obvious: unit testing is all about balancing cost-benefit. It’s about maximizing the regression protection you get vs. the maintenance price you need to pay for those tests. It’s engineering.
Grab a black coffee and join this extract from Victor’s Pro Unit Testing training. You will learn about testing priorities, avoiding buggy tests, testing exceptions with JUnit 5, the shared @Before nexus, guidelines for breaking an unit test, and crafting splendid expressive failures. In the end, based on the difference between a Stub and a Mock you’ll get applicable advises that can make your code a lot more testable and easy to understand, isolating tough critical logic inside a ‘circle of purity’. All of that in an entertaining, dynamic and memorable session.