mercredi 30 mai 2018

TestNG Factory Freezing

I have a TestNG factory that should create about 25 tests and run them all. It completes about 20 of them fully, and then freezes part of the way into the last test.

The basic structure looks like this:

myType[] array1 = { create x many myType objects here }
myType[] array2 = { create x many myType objects here }
myType[] array3 = { create x many myType objects here }
myType[] array1 = { create x many myType objects here }


@Factory
public TestClassName[] testFactory(){
    return new TestClassName[]{
        new TestClassName(Array1),
        new TestClassName(Array2),
        new TestClassName(Array3),
        new TestClassName(Array4),
    }
}

public class TestClassName extends TestCase{

    private myType[] myArray;

    TestClassName(myType[] array){this.myArray = array;}

    @DataProvider(parallel = true)
    private Iterator<myType[]> thingProvider(){return Arrays.stream(myArray).map(ArrayUtils::toArray).iterator();}

     @Test(dataProvider = "thingProvider()")
     private void doWork(MyType thing){
         //do some work on the thing here
     }

}

Any idea why a factory would just freeze like this? Could it have to do with using the dataProvider with parallel set to true?

Aucun commentaire:

Enregistrer un commentaire