lundi 30 mars 2015

ParallelParameterized - how to save test results in parallel for each input in same order as input?


@RunWith(ParallelParameterized.class)
public class RoutingResponseShortRegressionOneByOne {

private int numberOfProcessedRequests;
private Object currentRequestIndexLock = new Object();


@Test
public void compareNewResponseToBaselineReturnsNoLargeDifferences() throws IOException {

int currentRequestIndex;
synchronized (currentRequestIndexLock) {
//currentRequestIndex = e2EResultShort.completeRoutingResponses.size();
currentRequestIndex = numberOfProcessedRequests;
numberOfProcessedRequests++;
}


I try to run this code


and I see numberOfProcessedRequests == 0 in every run, and doesn't increment as I would expect from class member.


It's a ParallelParameterized Test.


Why does it create a new Test Class instance for every input?


I see the ctor is called only once.


Should there be a different way to run the test in parallel for each input and still maintain the order of the results as the order of the input?


Aucun commentaire:

Enregistrer un commentaire