Netbeans Profile JUnit 4 problem
I have a unit test that takes 200 sec to run. I am trying to use NetBeans profiler to speed it up. But the profiler doesn't run the unit test. It just creates an object of the test and exits. Doesn't run the actual test methods or @Before / @After methods.
This is a maven project with surefire and junit 4.
And partial output is below.
Profiler Agent: Waiting for connection on port 5140, timeout 10 seconds (Protocol version: 9)
Profiler Agent: Established local connection with the tool
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.cris.puzzle.solvers.SudokuSolverTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.031 sec
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
Profiler Agent: Connection with agent closed
Profiler Agent: Connection with agent closed
Profiler Agent: Initializing...
Profiler Agent: Options: >C:/Program Files/NetBeans 6.8/profiler3/lib,5140,10<
Prof开发者_JAVA百科iler Agent: Initialized succesfully
------------------------------------------------------------------------
BUILD SUCCESSFUL
------------------------------------------------------------------------
Total time: 14 seconds
Does anyone know how to make it work? Thank you.
There is a workaround. Move your test code into application code temporarily. Profile it and improve it. Once finished, move back your improved code to JUnit code.
Don't know, what is your OS, but in Win 7 (and probably also Vista), there is the problem with JUnit that it needs to have write permission to its directory (which is in default installation of NetBeans in Program files, and there it has not this access). But in that case, you would probably have problems with JUnit itself from the beginning.
精彩评论