You can use Assume to filter the datapoints. At the beginning of the test, add something like:
@Theory public void xxx(String[] result ,Integer[] checkdt ) {
Assume.assumeTrue("Y".equals(result[1]);
// rest of test
}
Question
i have 3 datapoints of string array and 2 datapoints of integer array.
@DataPoint public static Integer[] xxx ={100,200};
@DataPoint public static Integer[] x ={-14,15};
@DataPoint public static String[] xx = new String[]{"de" ,"Y"};
@DataPoint public static String[] cityCode = new String[]{"de" ,"abc"};
@DataPoint public static String[] city = new String[]{"de" ,"dfg"};
@Theory public void xxx(String[] result ,Integer[] checkdt )
when running this testcases it is taking 3 datapoints of string array,but i want to use only 2 datapoints of String array how can i use only 2 datapoints ?
Solution
You can use Assume to filter the datapoints. At the beginning of the test, add something like:
@Theory public void xxx(String[] result ,Integer[] checkdt ) {
Assume.assumeTrue("Y".equals(result[1]);
// rest of test
}
OTHER TIPS
As per my understanding there is no selection of specific DataPoint
to specicfic Theory
.
Each @Theory
will run against input parameters of @DataPoint
.
Do you want filter DataPoint data You can assert that input data which you want and run rest.