2013-05-12 94 views
6

我有一個簡單的ASP.Net MVC 4應用程序,有3個簡單的測試。VS 2012代碼覆蓋問題

每個測試運行成功完成,但代碼覆蓋率窗口給了我以下錯誤:

Empty results generated: No binaries were instrumented. Make sure the tests ran, required binaries were loaded, had matching symbol files, and were not excluded through custom settings. For more information see http://go.microsoft.com/fwlink/?LinkID=253731

我做了一些研究,但沒有解決了我的問題至今。

  • 我知道測試運行
  • 我在相同的位置.pdb文件作爲我的.dll
  • 我不代碼optimsing
  • 我無法找到任何文件.testsettings
  • 我作爲管理員也運行我的VS 2012旗艦版,但沒有運氣。

如果我找到.coverage文件,所有它在它是:

PCHÿ 

不是個XML結果或錯誤消息,我期待。

+0

我有這個問題,在我的情況下,它解決了當我以管理員身份運行Visual Studio – lmcarreiro 2016-03-30 14:36:55

回答

5

我意識到這已經過了一年多了。不過,我剛剛遇到完全相同的問題,甚至下載到.coverage文件中的「PCH」文本,直到現在都沒有找到解決方案。但肯定有其他人也有這個問題,以防萬一,以下是簡單的解決方案:

經過檢查此MSDN link並遵循其建議,我仍然有同樣的問題。於是,最後我關機VS,去了根目錄解決方案目錄,並且刪除了.suo文件的。它具有隱藏屬性設置,因此您可能需要設置瀏覽器以顯示隱藏文件。

重新啓動VS並重新運行代碼覆蓋測試。一切都好。

+0

嗨Shunty.This問題仍然存在。我發現其他地方提到刪除他.suo文件並重新啓動VS 2012,但仍然沒有運氣。我也刪除了整個TestResults文件夾,然後再次嘗試,沒有運氣。 – brettc4 2013-09-05 00:28:37

+0

我沒有問題,所以我不能給予更多的幫助。但是,也許,如果你的代碼是在源代碼控制之下,你可以嘗試將它檢出到一個新的位置,並從那裏構建/測試它,看看會發生什麼。我確信它必須與VS管理的一個臨時/本地文件有關,並且不應該進入源代碼控制,因此它可能工作。 – shunty 2013-09-05 08:09:53

4

如果即使刪除* .suo文件後仍無法使代碼覆蓋範圍工作,請檢查您的事件查看器是否有錯誤。就我而言,每次運行後,我有以下錯誤:

「追蹤日誌分析器未能初始化由於缺乏儀器方法,過程vstest.executionengine.x86.exe」

我發現答案是here

在情況下,鏈接不再可用,我粘貼內容在這裏:

If you find yourself with a an empty .coverage file and see errors similar to the below in your event logs you most probably have a corrupt install

(info) .NET Runtime version 4.0.30319.17929 - The profiler has requested that the CLR instance not load the profiler into this process. Profiler CLSID: '{b19f184a-cc62-4137-9a6f-af0f91730165}'. Process ID (decimal): 12624. Message ID: [0x2516].

(Error) TraceLog Profiler failed in initialization due to a lack of instrumentation methods, process vstest.executionengine.x86.exe

Check

a) Environment variable VS110COMNTOOLS is set to \common7\tools

b) Regkey HKLM\SOFTWARE\Microsoft\VisualStudio\11.0\InstallDir is set to your \Common7\IDE\

c) covrun32.dll and covrun64.dll exist in "\Team Tools\Dynamic Code Coverage"

祝你好運,

Nadav

+0

我的機器中沒有'covrun64.dll',Code Coverage工作正常。這不是問題。 – 2014-09-27 02:23:38

+0

感謝您的幫助!在我的情況下,環境變量設置不正確。沒有錯誤消息,只是沒有代碼覆蓋率的結果。 – Pegieo 2015-09-23 12:18:30

+0

很高興我能幫忙;-) – nadavy 2015-09-24 08:51:18