2

I have a problem with executing tests in JUnit. Imagine you have one test case class with f.e. 100 tests, no test suite and no main program - test case class test the device on com port. JUnit project is in Netbeans. I want to run tests - but not all of them at the same time, i would like to choose tests to run before actual testing.

Once I saw something like that in eclipse - but it wasn't my project and I don't know how it was done and how to do the same thing in netbeans. It was a separate window, poping up before running tests. In this window there were checkboxes with names of methods with @Test annotation and you could choose tests you wanted to run and click run - so it let you to run what you wanted.

Does anyone know how to do it in netbeans? Is it any library or plugin?

Any help will be appreciated.

Matthew Farwell
  • 60,889
  • 18
  • 128
  • 171
Doszi89
  • 357
  • 2
  • 5
  • 20

2 Answers2

1

You can take a look at Run single test from a JUnit class using command-line. It does allow you to specify what test you want to run given a class with multiple test cases in it. Being command-line you can then script your own test suite that runs the specific ones you want.

I also noticed your other question Junit: changing sequence of test running. With the scripting approach you can actually control the order of your testing.

This approach does not take advantage of Eclipse's or NetBean's JUnit test runners though, so it is a very specific workaround.

Community
  • 1
  • 1
Kevin Jalbert
  • 3,115
  • 3
  • 26
  • 39
0

Netbeans nowadays support running single tests:

enter image description here

R. Oosterholt
  • 7,720
  • 2
  • 53
  • 77