Questions tagged [parameterized-tests]
55 questions
0
votes
1 answer
Dynamically changing @MethodSource in abstract class from a @ParameterizedTest (Jupiter-Junit 5)
I am currently writing unit tests related to GET requests, here below is a parameterized test that take a generic type E.
abstract class AbstractEntityTest< E extends Entity > {
@ParameterizedTest( name = "[{index}]: {2}" )
@MethodSource(…

E-M-C
- 21
- 1
- 4
0
votes
1 answer
ParametrizedTest with displayName and Argument
I am trying to migrate from JUnit4 to JUnit5 and also I'm new to ParametrizedTest in Junit5 and I have a scenario wherein I would like to provide different DisplayName and the Test argument(Object).
Here's the data source I would like to use as an…

flowAlong
- 77
- 10
0
votes
0 answers
How to fix parameters in parameterized test?
I am using gtest for my tests and i am discovering value-parameterized tests.
I understand the google example with
int tab[] = {1, 2, 3};
INSTANTIATE_TEST_CASE_P(MyTestName, MyTest, ::testingCombine(Bool(), ::testing::ValuesIn(tab)));
It is…

YopAndMail
- 53
- 5
0
votes
1 answer
How do I include/exclude a JUnit 5 `ParameterizedTest` by name in Maven
I have a parameterized JUnit 5 test, e.g.
@EnumSource(Mode.class)
@ParameterizedTest void shouldRunWithMode(Mode mode) {
...
I want to exclude one of the enum cases from running in Maven, as described here:
…

rü-
- 2,129
- 17
- 37
0
votes
1 answer
Is it possible to disable one of the valueSource in a parameterizedTest?
I am using JUnit 5 and I have a test case like this:
@ParameterizedTest
@ValueSource(Strings = {a , b , c})
void example(String letter){
// do something
}
the c case is unhandled for now, so is it possible to use @Disabled to ignore only the c case…

Insurgent
- 1
- 1
0
votes
1 answer
why does it say "The attribute name is undefined for the annotation type Parameterized.Parameters"
I have written a code as follow:
but while compiling it throws the compilation error saying
"The attribute 'name' is undefined for the annotation type
Parameterized.Parameters"
@RunWith(Parameterized.class)
public class…

C.k.
- 93
- 2
- 13
0
votes
1 answer
Mocha paramterized test does not take the modified value of test data array
Here's the simple problem I'm struggling with. In the first example, no tests are run; whereas in the second one, two tests are run as expected.
Does not work as expected: // testData gets populated inside before here
// test.js
const assert =…

Akshay Maldhure
- 787
- 2
- 19
- 38
0
votes
1 answer
Parameterize pytest using fixture loaded from database
I'm trying to use pytest to take in an id for a suite to run, load the suite from a db, and then generate the test cases in a parameterized fashion. The code below shows the gist of what I want to do, but errors with fixture 'case' not found.
How…

Sevenless
- 2,805
- 4
- 28
- 47
0
votes
1 answer
IllegalArgumentException in parameterized test class
I have a parametric test class, and I have a test method which I am expected to return IllegalArgumentException.
@RunWith(value = Parameterized.class)
public class TriangleParametrizedTest {
@Rule
public ExpectedException exception =…

Azin
- 21
- 3
0
votes
4 answers
Enforcing that a JUnit subclass test overrides a @BeforeClass method
I have what amounts to a lightweight test framework written as a JUnit Abstract test. What I would like to do is have the implementing subclasses each define their custom test class setup. My plan was to have the abstract superclass define an…

Jeremy
- 180
- 2
- 8