I have created several files with unit tests on existing classes in NetBeans project. I used menu "File/New file/JUnit/Test for Existing Class" to create test files.
I can run one file with unit tests by right click on it and select "Run File".
But I want to run all files with unit tests. How can I achieve this in the simplest way?
I am using NetBeans 6.5.
Menu "Run/Test Project".
In NetBeans 7.1 you can create a test suite, to which you can add as many of your JUnit test files as you want. When you run the suite, you run all the files in the suite.
To create the test suite, create a file like any other:
In the main class add your test classes like this:
@RunWith(Suite.class)
@Suite.SuiteClasses(
{
com.somewhere.myProject.MyFirstTestClass.class,
com.somewhere.myProject.MySecondTestClass.class,
com.somewhere.myProject.MyThirdTestClass.class
})
To run, right click this file in the Projects windows and select Test File.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With