Compares JUnit 5 with Spock features by example.
Java Groovy
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
gradle
src
.gitignore
.travis.yml
README.adoc
build.gradle
gradlew
gradlew.bat
settings.gradle

README.adoc

JUnit 5 vs. Spock feature comparison Build Status

Covered features

Description JUnit 5 Spock

Test execution

@Test

Specification

Fixture set up and tear down

@BeforeEach, @AfterEach

setup, teardown

Descriptive test names

@DisplayName

Method name as String

Disabling tests

@Disabled

@Ignore

Expecting thrown exceptions

assertThrows

@FailsWith

Repeating test execution

@RepeatedTest

where statement with counter

Declaring timeouts

assertTimeout

@Timeout

Conditional test execution

assumeTrue, ExecutionCondition

@Requires

Data-driven tests

@ParameterizedTest, @MethodSource

where statement with table

Mocking

Mockito

Built-in mock capabilities

Filtering test execution

@Tag

Custom annotations with runner configuration

Extending the test framework

@ExtendWith

@ExtensionAnnotation

Executing the tests

All tests can be executed with the help of Gradle. The project provides a Gradle Wrapper so no installation of the Gradle runtime is needed.

Windows:

> gradlew.bat check

*nix:

$ ./gradlew check