@RunWith(Theories.class)
public class ExampleTest {
@Theory
@Test
public void isEven(int value)
{
assertEquals(value%2,0);
}
public static @DataPoints int[] values = valueBuilder();
private static int[] valueBuilder(){
int[] returnValue= {1,2,3,4,5,6,7,8,9,10};
return returnValue;
}
}
I was able to run a test for different sets of data like from above.
Current Approach:
Runs as a single test Case for all 10 items of data. (more like a for loop).
One Failure causes the test to stop.
Need:
-> Some approach to run this test as 10 independents tests. Show failed cases as failed and continue running for other data items.
Thanks In Advance.
@RunWith(Parameterized.class)
public class ExampleTest {
@Theory
@Test
public void isEven(int value)
{
assertEquals(value%2,0);
}
public static @DataPoints int[] values = valueBuilder();
// Provide data
@Parameters
private static int[] valueBuilder(){
int[] returnValue= {1,2,3,4,5,6,7,8,9,10};
return returnValue;
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.