swtbot 测试中如何解决no tests found

SWTBot是一个用于测试eclipse plugin及基于swt的应用程序的框架。该项目目前已经放到org.eclipse组织下了。对于GUI测试,SWTBot相当好用。其灵活的API,让开发人员使用起来得心应手。下面是最近在开发中遇到的问题,总结出来,供大家参考。

在写SWTBot测试程序时,定义一个test,我原先是继承Junit的TestCase类,使用Junit3来运行测试,其工作正常。后来发现SWTBot有一个类SWTBotEclipseTestCase,其定义了一些针对widget的断言方法。这些方法相当有用。因此把自己的测试类改为继承此类,但是再用Junit3来运行时,就提示junit.framework.AssertionFailedError: No tests found in XXX.class。 一开始百思不得其解,后来通过网上搜索,发现原来SWTBotEclipseTestCase是基于Junit4来写的。其测试风格与Juint3不兼容。因此使用Junit4来运行该测试就可以了。

下面是引用的内容:
Hi Marko,

Thanks for this input. I think I understand what the problem has been all along.

I'd like to clarify that SWTBot does work with junit3 style tests, but you need to depend on the junit4 plugin in order to do this.

The reason for this is the fact that the SWTBot launcher is compiled against JUnit 4.x and gets confused when it sees your tests are running against junit 3.x.

Could you please verify this behavior ? I'll update the user guide and documentation about this particular case, the documentation is quite out of date, and has not been updated in a while after the move to junit4.

-- Ketan

http://www.eclipse.org/newsportal/article.php?id=428&group=eclipse.swtbot#428
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值