Easily create builders for your tests using Intellij IDEA

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

Using C# anonymous types to assert complex results in your unit tests

Does this sounds familiar to you: You come to work early(ish) in the morning - ready to apply a new technology you've just learnt about - just to find out that you can't. Your frustration grows as you understand that in order to use this "new and shiny" some adjustments must be made and what … Continue reading Using C# anonymous types to assert complex results in your unit tests

Assert.AreEqual in MSTest – done right

Every unit testing framework out there comes with a plethora of assertion methods - this is not necessarily a good thing. Instead of writing simple code a developer is forced to choose the correct assertion method from a seemingly endless list of methods, most of which look exactly the same! Having multiple overloaded methods with … Continue reading Assert.AreEqual in MSTest – done right

New Pluralsight course: Advanced C++ Mocking Using Google Mock

My latest course: Advanced C++ Mocking Using Google Mock was published during the weekend. After finishing my very first Pluralsight course I knew I want to author another one. I've been working with C++, Java and .NET developers for the last five years, teaching about clean code, design patterns and unit testing. I've seen good developers struggle with TDD, … Continue reading New Pluralsight course: Advanced C++ Mocking Using Google Mock

Faking DateTime using Microsoft Fakes seems to be broken

It seems as if causing DateTime.Now to return another value has become the demo to show when demoing an unconstrained Mocking framework. It’s easy to show and needed in many unit tests – unless you want your tests to be affected by time – trust me and you don’t. That’s why I was amazed to … Continue reading Faking DateTime using Microsoft Fakes seems to be broken

New Pluralsight course: C++ Unit Testing Fundamentals Using Catch

Last week my very first Pluralsight course went live!My course on unit testing in C++ using CATCH is ready for your viewing pleasure. It’s about a topic I’m passionate about - how to write good unit tests, I’ve used Catch because I found that it helps writing good tests while avoiding many of the pitfalls … Continue reading New Pluralsight course: C++ Unit Testing Fundamentals Using Catch