Victor Rentea – Unit Testing like a Pro: The Circle of Purity

laatste update: 01-2023


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.

28 gedachten over “Victor Rentea – Unit Testing like a Pro: The Circle of Purity”

  1. It's pity when an exciting and important topic is described in a clown manner.

  2. I am little confused about extracting a method out to create pure function at 55:38 , which is good for testing… But that will also mean that we have to make the method public? It may not be an API we want to expose!

  3. Most basic shit ever. This idiot has no idea. He hides his incompetence behind fake excitement.

  4. Basic content, and he's not funny contrary to what he must be thinking.
    Poor audio hinders understanding in addition to his strong accent (btw I'm not native English speaker either maybe that's why I find it hard to understand all the words) and the automatic closed captions are in… Dutch! (not his fault I guess although Devoxx could have fixed that)

  5. Your voice is so annoying brother. I got bad impression on unit tests

  6. For date comparison, AssertJ comes with "isCloseTo", with time tolerance. Should be simpler than truncating.

  7. good stuff. shared it with the rest of my team. thank you for giving this talk. it was a lil hard to understand, maybe in the future work on English enunciation. but other than that, good stuff.

  8. To not break the encapsulation one might use Whitebox library to directly access private methods.

  9. Good stuff. Still, I can't agree on using those BDD-style ".feature files", IMO they're just a waste of developer time.

  10. Nice. Unfortunately the microphone hasn't been tested first.

  11. Thanks a lot Victor, this according to me is one of the best talks on testing. It made me look at the test code in a whole new light. Salute!

  12. One of the best talks on testing code. Kudos to you

  13. best + most practical talk on unit testing, Kudos to the presentation Victor! Keep it up.

  14. Quite a few can be solved with a more expressive/verbose framework like AssertJ (expecting throws, collection test failure legibility etc). Love your style Victor!

  15. Hello friends of DEVOXX.
    it is possible some way to consider in your events. that the translations are more understandable into Spanish. the ayoria of the videos, by the way excellent can not be fully understood, due to the poor translation of the Dutch (by default) — into Spanish. Is there any method or way to have a better translation?

    The event is coming on March 22, 2022 and we would like to have a better translation friends, sorry for the inconvenience of people on this other side of the Spanish world.
    Thank you and may you be well

Reacties zijn gesloten.