junit

3 posts

Spock random order of tests - how to?

Spock Framework executes test methods (features) in a single class (specification) in the declaration order. There is nothing wrong in this default behavior - we should write tests with their isolation in mind. However, in some cases, we would like to randomize test methods execution. Today we are going to learn how to do it.

JUnit Assume.assumeNotNull(obj) throws NullPointerException in Groovy - what's wrong?

Ignoring some of the unit tests when given conditions are not satisfied is a handy feature of a JUnit framework. I guess you have used many times constructions like Assume.assumeTrue(expr) or Assume.assumeNotNull(expr) in your test code. Today I would like to show you one pretty interesting corner case when the usage of Assume.assumeNotNull(expr) throws NPE in the unit test written in Groovy.

How to avoid "No tests were found" when using JUnit 5 with Groovy?

In this short blog post I would like to explain how to avoid popular mistake when you write your first JUnit 5 test case in Groovy.