How do I run JUnit from NetBeans?

前端 未结 6 1332
臣服心动
臣服心动 2020-12-30 02:41

I\'ve been trying to understand how to start writing and running JUnit tests.

When I\'m reading this article:

http://junit.sourceforge.net/doc/testinfected/t

6条回答
  •  执念已碎
    2020-12-30 03:13

    Re-importing does not appear to be necessary. I had the same issue (imported project, right clicking did not bring up any JUnit test options). I took these steps, which resolved it, using NetBeans 6.8:

    1. Add a folder called "tests" to your project.
    2. Right-click your project and select Properties.
    3. Select Sources.
    4. Under Test Package Folders, click the Add Folder button, and select the "tests" folder.
    5. Right clicking a file + Tools > Create JUnit Tests.
    6. Once a test is created, right-clicking a file + Test File runs the test.

提交回复
热议问题