我从事一个需要符合 jdk1.4 的 Maven 项目。我们的 testng 类使用伪 javadoc 注释来定义测试。
/**
* @testng.test
*/
在 Netbeans 中,右键菜单可以很好地运行测试。在 Eclipse 中,我的同事告诉我它不起作用并且找不到测试类。所以我一直在尝试向测试类添加一个 main() ,使用类似的东西
TestNG testng = new TestNG();
testng.setTestClasses( new Class[]{MyTestClass.class} );
testng.run();
但是当我这样做时,我得到以下结果:
Command line suite
Total tests run: 0, Failures: 0, Skips: 0
所以,基本上,没有找到测试,这并不让我感到惊讶,因为需要解析 javadoc 而我不知道它是如何发生在这里的。有没有人遇到过类似的问题?您是如何绕过它以便可以在 Eclipse 中轻松测试单个类的?