The builder pattern is one of the more useful patterns out there when creation unit tests. Instead of having a huge initialization such as: @Test void validateUser_userNameIsEmpty_returnFalse(){ var user = new User(); user.setId("id-1"); user.setName(null); user.setPhoneNumber("555-1234"); // additional user initialization boolean result = userService.validate(user); assertFalse(result); } You can instead create a simple user builder object for … Continue reading Easily create builders for your tests using Intellij IDEA
Category: Tools
Better tests names using JUnit’s display names generators
Writing unit tests can be challenging, but there is one thing that can get you on the right track - the test name. If you manage to give your test a good name - you will write a good test. Unfortunately in some (read: many) unit testing frameworks the test name must be a valid … Continue reading Better tests names using JUnit’s display names generators
5 commands to get you up and running with Docker
Docker has revolutionized the way software is being written and deployed throughout our industry. With the use of it's lightweight containers you can deploy your whole environment locally - or in your clients machine quickly and easily. At Practical Software we've used Docker to test how multiple servers behaves when one of them crash and … Continue reading 5 commands to get you up and running with Docker
Getting started with C++ unit testing
I have been "living" in the C++ world since the very beginning (of my career). But lately I've noticed a rising interest in C++ unit testing and even got to speaking about it in NDC Oslo. But there's more to it than testing 10 year old C++ legacy code - it is my opinion that … Continue reading Getting started with C++ unit testing
Using nDepend to understand, and improve legacy code
One of the issues when dealing with legacy code is missing information. Unlike newly developed code which has up to date documentation or at least some developers who know design decisions and implementation details. Legacy code is a completely different story - the original developers usually are not around to answer any questions, documentation is … Continue reading Using nDepend to understand, and improve legacy code