首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Eclipse开发 >

MyEclipse junit测试窗口有关问题!

2012-02-01 
MyEclipse junit测试窗口问题!!!!普通类package cn.zt.a1public class T {public int add(int x, int y)

MyEclipse junit测试窗口问题!!!!
普通类
package cn.zt.a1;
public class T {
public int add(int x, int y) {
return x + y;
}

public static void main(String[] args) {
int z = new T().add(3, 5);
System.out.println(z);
}
}
测试类

package c.zt.test;

import static org.junit.Assert.*;
import org.junit.Test;
import cn.zt.a1.T;

public class TTest {
@Test
public void testAdd() {
int z = new T().add(5, 3);
assertEquals(8,z);
}

}

测试的时候,junit没测试窗口有反映!



[解决办法]
用junit测试 其测试类应继承TestCase 并应该有public static void Test() {}类方法
[解决办法]

探讨

用junit测试 其测试类应继承TestCase 并应该有public static void Test() {}类方法

热点排行