Even if they are at the basis of the software testing pyramid and they are at the heart of the Test-Driven Development (TDD) approach, unit tests are still a controversial topic in software development and some people event consider that most unit testing is waste. In his blog post, Bas Dijkstra explains why he thinks that unit testing should be the basis of any solid automation strategy.
Tutorials and resources on how to apply unit testing in software testing
JUnit 5 is the next generation of JUnit. The goal of this upcoming version is to create an up-to-date foundation for developer-side testing on the JVM. The evolution includes focusing on Java 8 and above, as well as enabling many different styles of testing. In his article, Nicolai Parlog explains how you should write tests with JUnit 5.
When you perform unit testing, there are many situations where you don’t have the full code or the right context that is needed to execute it. It might be that part of the code is not written yet or that you interact with an external system that is difficult to access or you don’t want to impact with unit tests. In these cases, you need to create a test double, an object that behaves like its production equivalent. In this article, Michał Lipski describes three types of test doubles – fake, stub and mock – and gives you examples when to use them in your unit testing.