在测试代码的时候 Junit 怎么写呢??方法是自己写还是自己就有呢??请指点下

解决方案 »

  1.   

    public class xxx extends TestCase 
    {
        protected void setUp() {//初始化,加载信息
        }
        public void testyyy() throws InterruptedException{//test为前缀的方法,执行部分在此
         }
    }
      

  2.   

    把你测试function中使用的参量设置为已知量,在testFunction中使用看是否能得到你需要的输出
    public void testFunction()
     {
        ……
       assert.assertEqual(得到的结果,“期望的结果”);
     }