2010-05-24 65 views
2

我有一個需要200秒運行的單元測試。我正在嘗試使用NetBeans分析器來加速它。但分析器不運行單元測試。它只是創建一個測試對象並退出。不運行實際的測試方法或@Before/@After方法。Netbeans Profile JUnit 4問題

這是萬無一失和JUnit 4

和部分輸出低於Maven項目。

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< 
Profiler Agent: Initialized succesfully 
------------------------------------------------------------------------ 
BUILD SUCCESSFUL 
------------------------------------------------------------------------ 
Total time: 14 seconds 

有誰知道如何使它工作?謝謝。

回答

0

有一種解決方法。將您的測試代碼暫時移入應用程序代碼。分析並改進它。完成後,將改進的代碼移回JUnit代碼。

+0

嗯,是的,但我想知道如何通過JUnits進行配置文件。感謝您的時間。 – 2011-08-09 10:15:11

0

不知道什麼是您的操作系統,但在Win 7(也可能是Vista)中,JUnit存在的問題是它需要對其目錄具有寫入權限(這是NetBeans的默認安裝程序文件,並且它沒有這個訪問權限)。但在這種情況下,您可能會從一開始就遇到JUnit本身的問題。