简体   繁体   English

运行NetBeans中给定软件包中的所有junit测试?

[英]Run all the junit tests that are in a given package in Netbeans?

We have a bunch junit tests in our current project. 在当前项目中,我们进行了大量的junit测试。 Essentially we are looking for a way to run all the test in a given package. 本质上,我们正在寻找一种在给定程序包中运行所有测试的方法。 Currently in Netbeans I see you can run all the tests or a single test, but no way to run aa sub-set of tests. 目前在Netbeans中,我看到您可以运行所有测试或单个测试,但是无法运行测试的子集。

Is this built into Netbeans? 这是Netbeans内置的吗? Or is there another way we can do this? 还是有另一种方法可以做到这一点?

In JUnit this is achieved through TestSuite. 在JUnit中,这是通过TestSuite实现的。 You can check for more information here (look at the code, not at the pictures). 您可以在此处查看更多信息(查看代码,而不是图片)。 At least in the Eclipse IDE there is a functionality that lets you add a new TestSuite, select which tests it is to include and then have the IDE generate it for you. 至少在Eclipse IDE中,有一项功能可以让您添加新的TestSuite,选择要包含的测试,然后让IDE为您生成它。 I haven't seen such thing in Netbeans, but you should check for any additional JUnit plugins. 我在Netbeans中还没有看到这样的东西,但是您应该检查是否有其他JUnit插件。

只需像在此问题上记录的那样设置junit测试组,然后通过您的ant或maven构建来运行测试组。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM