Jutil 单元测试

eclipse 自身集成了jtuil,右击项目,点击bulidpath,addjar,如下所示添加jutil

                                       

                                        

新建一个Junit的测试类用来测试上面的测试方法,新增Junit的测试类方法如下:

                                  

 

// 被测试案例
package hazardsource;

public class testcase {
    public void hello() {
        System.out.println("hello");
        System.out.println("Hello");
    }
    
    public void print() {
        System.out.println("helwe f");
    }

}

 

// 测试案例
package test;

import static org.junit.Assert.*;

import org.junit.Test;

import hazardsource.testcase;

public class TTest {

    @Test
    public void test() {
        testcase a = new testcase();
        a.hello();
    }
    
    @Test
    public void test2() {
        testcase a = new testcase();
        a.print();
    }
    

}

 

注意: 创建jutil.test.case 之后,类的名字以及方法名字都可以进行修改

 

上面使用的eclipse自己携带的,来进行测试的,网上说可以通过自己导入jutil相关的包之后,再进行相关操作

 

 (一个渣渣的救赎之路)

 

posted on 2019-06-27 10:27  黄山一叶  阅读(245)  评论(0编辑  收藏  举报