Skip to content

How do I repeat a test case with JUnit 5? #4608

Answered by marcphilipp
trancexpress asked this question in Q&A
Discussion options

You must be logged in to vote

The recent 5.13.0 release introduced @ParameterizedClass and @ClassTemplate. There's no equivalent to @RepeatedTest on the class level, yet.

Here's a quick implementation:

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.stream.IntStream;
import java.util.stream.Stream;

import org.junit.jupiter.api.extension.ClassTemplateInvocationContext;
import org.junit.jupiter.api.extension.ClassTemplateInvocationContextProvider;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.extension.ExtensionContext;

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@trancexpress
Comment options

@marcphilipp
Comment options

@trancexpress
Comment options

Answer selected by trancexpress
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants