My @DataProvider looks like this:
@DataProvider(name = "data")
public Object[][] data() throws Exception {
List myList= DBHelper.getList("SELECT x FROM property"); //Get DB data to list
Object[] myArray = myList.toArray();//Convert to array
int len = myArray .length; //Get max array index
int randomIndex = General.createRandNumber(len); //create a random index
return new Object[][]{
{myArray [randomIndex]},
{myArray [randomIndex]},
};
}
When I am running the @Test I get Test ignored - unless I replace randomIndex with a real number, for example: {myArray [0]},
I am unable to figure out why that happens and would like to hear the explanation for that.
Thanks.
Figure that out...
The problem was that I was using len as the length of the randomize number which result with non-existing DB index. That is why the test failed. Sometime you get confused from the simple things... (-:
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.