views:

212

answers:

2

I'm using Netbeans 6.8 and the finest-grained way to run my JUnit tests from the IDE appears to be to right-click a class under Test Packages and click Test File

In Eclipse it's possible to narrow the scope to testing an individual method in a given test harness. How do I test only one individual test out of a harness in Netbeans?

A: 

As best as I can tell NetBeans doesn't support this. NetBeans does all of it's execution through ant scripts. The most granular ant target they build is test-single. The test-single target uses a property named test.includes to determine which files to execute through JUnit. It's a file name matching pattern and will not be able to specify a single method.

carlism
+2  A: 

UPDATE: NetBeans supports this (e.g. see NetBeans 6.8). Just right click the passed or failed test and then click 'Run Again' or 'Debug'.

Old:

To my knowledge this is not possible. And maybe the NetBeans-guys had in mind that always all tests should pass for one unit. I know that tools should not limit the developers, but If one method takes too long - maybe you should consider a separate integration test?

Also take a look at this post. (BTW: in maven projects running tests of a unit is possible ...)

Karussell
Thanks for coming back and updating this :)
Maciek
no problem. as a netbeans user this bothered me too. is this working for you? it seems to be only available for maven projects!?
Karussell