@Retention(value=RUNTIME) @Target(value={FIELD,PARAMETER}) public @interface IteratedParameter
IteratedParameter
. Parameters are injected by tapir at Test execution
runtime. There are several ways how to provide the data:
Iterable
of the parametervalue()
or method()
: You have to implement a method with the given name in the test class which returns
an Iterable
of the parameterproviderClass()
: The given providerClass has to provide a method which returns the parameter. The method name
can be derived from the field / parameter name or explicitly specified by using value()
/method()
.Iterable
the test class or step is executed. As you can annotate as many fields and
step parameters as you like tapir executes them by using the cartesian product.
Example:
@TestClass
class MyTest {
@IteratedParameter String stringParameter
@IteratedParameter Integer integerParameter
@Step def step1(@IteratedParameter String stepStringParameter, @IteratedParameter Integer stepIntegerParameter) {
}
override stringParameterParameter() {
#["a", "b"]
}
override integerParameterParameter() {
#[1, 2]
}
override step1StepStringParameterParameter() {
#["y", "z"]
}
override step1StepIntegerParameterParameter() {
#[8, 9]
}
}
step1 will be executed 16 times:
stringParameter | integerParameter | stepStringParameter | stepIntegerParameter |
a | 1 | y | 8 |
a | 1 | y | 9 |
a | 1 | z | 8 |
a | 1 | z | 9 |
a | 2 | y | 8 |
a | 2 | y | 9 |
a | 2 | z | 8 |
a | 2 | z | 9 |
b | 1 | y | 8 |
b | 1 | y | 9 |
b | 1 | z | 8 |
b | 1 | z | 9 |
b | 2 | y | 8 |
b | 2 | y | 9 |
b | 2 | z | 8 |
b | 2 | z | 9 |
Parameter
.Parameter
public abstract String value
public abstract String method
Copyright © 2018–2020 b+m Informatik AG. All rights reserved.