I want to create a launcher/run configuration which runs only the JUnit tests in a selected set of test classes or selected set of packages. Now it looks like I'll have to create separate run configurations for each of my packages containing the tests I want to run. I also have a recollection of this working in older versions of Eclipse.
我想创建一个启动器/运行配置,它只在一组选定的测试类或选定的包中运行JUnit测试。现在看来我必须为包含我想要运行的测试的每个包创建单独的运行配置。我也回忆起这个在旧版Eclipse中的工作原理。
And yes, I know: The tests should be organized so that I wouldn't have this problem but reorganizing source folders right now is not an option.
是的,我知道:应该组织测试以便我不会遇到这个问题但是现在重新组织源文件夹不是一个选择。
I'm using Eclipse 3.4.2.
我正在使用Eclipse 3.4.2。
3 个解决方案
#1
You can create a JUnit test suite like this :
您可以像这样创建一个JUnit测试套件:
JUnit Test Suite http://i39.tinypic.com/2mdqz37.jpg
JUnit测试套件http://i39.tinypic.com/2mdqz37.jpg
#2
You could add a test suite for the selected tests.
您可以为选定的测试添加测试套件。
I would put them in a separate source folder, as otherwise tests will be run multiple times, once for the original test and once for each suite it is in.
我会将它们放在一个单独的源文件夹中,否则测试将会多次运行,一次用于原始测试,一次用于它所在的每个套件。
#3
Hod do I run a JUnit test suite in Eclipse? Yes, organizing the source folders in a sane way should be done, but it would be a massive amount of work for this project (the build files are a royal mess) and we can't afford that right now.
我在Eclipse中运行JUnit测试套件吗?是的,应该以一种理智的方式组织源文件夹,但这对于这个项目来说将是一项大量的工作(构建文件是一个皇家混乱),我们现在负担不起。
auramo
You choose your TestSuite and press Alt+Shift+X, T or do Run -> Run As -> JUnit Test
.
您选择TestSuite并按Alt + Shift + X,T或执行Run - > Run As - > JUnit Test。
#1
You can create a JUnit test suite like this :
您可以像这样创建一个JUnit测试套件:
JUnit Test Suite http://i39.tinypic.com/2mdqz37.jpg
JUnit测试套件http://i39.tinypic.com/2mdqz37.jpg
#2
You could add a test suite for the selected tests.
您可以为选定的测试添加测试套件。
I would put them in a separate source folder, as otherwise tests will be run multiple times, once for the original test and once for each suite it is in.
我会将它们放在一个单独的源文件夹中,否则测试将会多次运行,一次用于原始测试,一次用于它所在的每个套件。
#3
Hod do I run a JUnit test suite in Eclipse? Yes, organizing the source folders in a sane way should be done, but it would be a massive amount of work for this project (the build files are a royal mess) and we can't afford that right now.
我在Eclipse中运行JUnit测试套件吗?是的,应该以一种理智的方式组织源文件夹,但这对于这个项目来说将是一项大量的工作(构建文件是一个皇家混乱),我们现在负担不起。
auramo
You choose your TestSuite and press Alt+Shift+X, T or do Run -> Run As -> JUnit Test
.
您选择TestSuite并按Alt + Shift + X,T或执行Run - > Run As - > JUnit Test。