Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/go/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
重复JUnit3测试_Junit_Junit4_Junit3 - Fatal编程技术网

重复JUnit3测试

重复JUnit3测试,junit,junit4,junit3,Junit,Junit4,Junit3,我正在为maven使用Apache的Surefire JUnit插件 我想在JUnit3.x中重新运行一个测试套件。这在JUnit4中很容易实现,它提供了“参数化”注释 你知道我如何在JUnit3.x中做到这一点吗 我的目标是运行整个测试套件两次,以便将两个不同的测试数据植入所有测试。在JUnit 3.x中,您可以定义自己的测试套件。如果你加上 public static Test suite() 方法,而JUnit将运行在返回变量中定义的所有方法。你可以看着(这个问题)或 您也可以这样做:

我正在为maven使用Apache的Surefire JUnit插件

我想在JUnit3.x中重新运行一个测试套件。这在JUnit4中很容易实现,它提供了“参数化”注释

你知道我如何在JUnit3.x中做到这一点吗


我的目标是运行整个测试套件两次,以便将两个不同的测试数据植入所有测试。

在JUnit 3.x中,您可以定义自己的测试套件。如果你加上

public static Test suite() 
方法,而JUnit将运行在返回变量中定义的所有方法。你可以看着(这个问题)或

您也可以这样做:

public static Test suite() {
    TestSuite suite = new TestSuite(YouTestClass.class);
    suite.addTest(new TestSuite(YouTestClass.class)); //you want to run all twice
    // suite.addTest(new YouTestClass("foo", 0);
    // for (int i = 0; i < TEST_SETALL.length; i++) {
    // suite.addTest(new YouTestClass("setAllTest",i ));
    // }

    Test setup = new TestSetup(suite) {
        protected void setUp() throws Exception {
            // do your one time set-up here!
        }

        protected void tearDown() throws Exception {
            // do your one time tear down here!
        }
    };

    return setup;
}
公共静态测试套件(){
TestSuite=新的TestSuite(YouTestClass.class);
suite.addTest(newtestsuite(YouTestClass.class));//您想全部运行两次吗
//suite.addTest(新的YouTestClass(“foo”),0);
//对于(int i=0;i