Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有我的 junit 测试类。我正在用 ant 运行这些类。我正在使用带有参数 includes="* / Test *.class"的 batchtest 属性,但我的类名称如 * test * 不包含测试方法,当我运行它会给出错误“找不到测试”。是否有一个选项,比如如果课堂上没有测试然后跳过?
要回答这个问题,您需要提供更好的模式。
潜在的解决方案:
将所有合法的测试类重构为带有前缀的BEGINTest , 然后将 ant 脚本更改为:
Test
includes="*/Test*.class"
为什么你的类中有名为“Test”的类不是测试?我强烈建议遵循一个命名约定,该约定放在Test开头并test从您的文件名中删除实际上不是测试的文件名。
test