簡體   English   中英

在Eclipse中的JUnit測試上調試斷點不起作用

[英]Debugging breakpoints on JUnit test in Eclipse are not working

我試圖在日食中調試junit測試,但我的斷點沒有觸發(除非它們在第一行或第二行)。

我已經嘗試刪除並重新創建工作區中的所有斷點,清理項目,創建新的調試配置,以及單獨運行測試方法以及使用其他方法作為測試類的一部分。 但一切都無濟於事:-(

 public void testLoadPatientsAndConvertToBeans() throws IOException, CDataGridException {
  File file = fileutil.getFileFromPrefsOrPrompt(basefileDef);

  CDataBuilder builder = new CDataDelimitedFileBuilder(file, 
    CDataDelimitedFileBuilder.DelimiterSettings.WINDOWS_CSV,
    basefileDef);

  // breakpoints placed on lines from here on do not fire

  CDataCacheContainer container = 
   cacheIO.construct(
     new CDataNarrower(
       cacheIO.construct(builder)
     ).setConvertMissing(true));

  assertEquals(13548, container.size());

  cacheIO.export(container, patients);

  Collection<Patient> pBeans = patients.getBeans();

  assertEquals(container.size(), pBeans.size());

  Patient patient = pBeans.iterator().next();
  Map props = patient.getPropertyMap();

  System.out.println(props);
 }

如果您使用的是Sun JDK 6 Update 14,則可能會出現這種情況。請參閱此處另一個類似的SO問題 在這種情況下,可能的解決方案是使用Sun JDK 6 Update 16。

我的第一個直覺是eclipse中的緩存類與你的代碼不同步。 但是,鑒於您已嘗試清理/重建項目,它應該已修復它。 因為你可以在第1行/第2行放置一個斷點,當你單步執行代碼時會發生什么? 代碼是否與每個步驟一致? 如果沒有,則表明eclipse與源代碼具有不同版本的類。 如果它們是相同的,我會嘗試刪除一個較新的eclipse副本(我假設你已經嘗試重啟你的eclipse),因為你可能發現了一個奇怪的錯誤(新版本可能已修復它或清理一些陳舊的數據)。 對不起,我不能再有幫助了。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM