문제

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:

enter image description here

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top