How to run all JUnit test cases from NetBeans?

泄露秘密 提交于 2019-12-05 06:06:35

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!