How do I run JUnit from NetBeans?

前端 未结 6 1327
臣服心动
臣服心动 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条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-30 03:09

    One way is to right click on your project in the Projects pane and select "Tests". That will run the JUnit tests. You can also right click on the test file and select "Run Test" and that single file will be ran. The keyboard shortcuts depends on how you have your keymapping set, but you'll see them in the context menus.

    You can also have NetBeans autogenerate tests for you by right clicking your source file and then "Tools > Create JUnit Tests".

提交回复
热议问题