Skip to content

Skipping parameterized tests based on bug annotation and value of first parameter #4189

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

You must be logged in to vote

There are extensions that allow doing so based on the value of arguments or the resulting display name: https://junit-pioneer.org/docs/disable-parameterized-tests/

For your custom logic, you can implement an InvocationInterceptor like this:

import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assumptions.assumeFalse;

import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import java.lang.reflect.Method;
import java.lang.reflect.Parameter;
import java.util.List;
import java.util.Objects;

import org.junit.jupiter.a…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@koranke
Comment options

Answer selected by koranke
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