0

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 ?

vinod
  • 1,115
  • 4
  • 13
  • 24

2 Answers2

1

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.

NPKR
  • 5,368
  • 4
  • 31
  • 48
1

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
}
Matthew Farwell
  • 60,889
  • 18
  • 128
  • 171