Junit创建测试包 -- 手工创建与自动创建
上一篇 /
下一篇 2009-09-03 15:52:21
/ 个人分类:单元测试
7Im"T Qg9K}pl0/**51Testing软件测试网n&~T0@d3x*e^
*手工创建:
*W I8k0q
\9Oyt0*下面这个简单的测试运行器负责创建测试包,首先添加各个测试然后添加整个测试包。
?;x-E,I4m!o1r7@0*/
!N3J0q\
V7qx+T0import junit.framework.Test;
SQX;j9Y0T1Z0import junit.framework.TestSuite;51Testing软件测试网]xD0_^-u*k/e
.i WEp7\Bi~+i6v
Z0public class TestRunner {51Testing软件测试网DS3wTi(s6h
public static TestSuite suite() {
3i'YA&I9Y#f*{4Ob0 TestSuite t = new TestSuite();51Testing软件测试网-H,BqA(zM6}}
]
t.addTest(new HelloWorldTest("testSayHello"));
T
C R2m@#gD$^!v0 t.addTest(new SimpleTest("testTest"));51Testing软件测试网!W0P X3ZmcNeL
t.addTestSuite(TestRunner.class);51Testing软件测试网 I,TLo(k-y!x
return t;
p"f2^+{Cp0 }
$T|c&o#K6H.D'Xy051Testing软件测试网(\Aw)N%QLz
public static void main(String args[]) {
Na6^#jlN0 junit.textui.TestRunner.run(suite());51Testing软件测试网(OBU.?},a]S6s[
}