TestNG使用感想

最近两天主要研究了testng的使用,testng是junit的扩展和替代品.充分利用了JDK1.5注释功能,在你需要的测试方法前只需要添加@Test.把需要的包加入你的项目;就可以运行测试程序了.告别了junit的每一个测试方法都需要继承TestCase.单元的集成测试也很方便,通过配置testng.xml文件可以轻松的实现单元的集成测试!具体的使用还要进一步的研究.testng.xml格式内容如下:
<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" >
<suite name="Example" >
<test name="Simple example" >
<groups>
<run>
<include name="assert" />
<include name="fail" />
<include name="odd" />
<include name="even" />
<exclude name="broken" />
</run>
</groups>
<classes>
<class name="example1.Test1" />
<class name="example1.Test2" />
</classes>
</test>
</suite>
通过groups可以实现单元测试的分类.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值