您的位置:首页 > 编程语言

Junit测试编程

2015-12-27 03:06 288 查看
public class CountTest extends TestCase {

private Count count;

//初始化方法,执行CountTest类时,先来执行该方法
protected void setUp() throws Exception {
super.setUp();
count = new Count();
}

//清理方法,测测结束后执行该方法
protected void tearDown() throws Exception {
super.tearDown();
count = null;
}

//在被测试的方法名钱自动加入test并使方法名的第一个字母大写
public void testEncrypt() {
assertEquals(“测试testEncrypt()方法失败!”,
count.encrypt(10),”YXQ120″);
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: