junit批量测试

引入一种“测试套件”的概念:

package test;

import org.junit.Test;

public class Test1 {
    private int value = 1;
    public void function(){
        System.out.println(value);
    }
    @Test
    public void test1(){
        function();
    }
}

 

 

package test;

import org.junit.Test;

public class Test2 {
    private int value = 2;
    public void function(){
        System.out.println(value);
    }
    @Test
    public void test(){
        function();
    }
}

 

 

package test;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;

@RunWith(Suite.class)
@SuiteClasses({
    Test1.class,
    Test2.class
})
public class SuitTest {

}

 

posted on 2016-03-29 16:09  J·Marcus  阅读(579)  评论(0编辑  收藏  举报

导航