ParallelParameterized - 如何以与输入相同的顺序为每个输入并行保存测试结果?

时间:2015-03-30 07:57:37

标签: java multithreading unit-testing junit concurrency

@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++;
        }

我尝试运行此代码

我在每次运行中都看到numberOfProcessedRequests == 0,并且没有像我期望的那样增加。

它是ParallelParameterized Test

为什么要为每个输入创建一个新的Test Class实例?

我看到ctor只被召唤一次。

是否有不同的方法为每个输入并行运行测试并仍然按输入顺序维护结果的顺序?

0 个答案:

没有答案