2010-08-30 130 views
2

任何更好的方法來做到這一點?我用從Visual Studio庫的連續測試插件,但不與SolutionFolders工作..單元測試構建

,所以我只是增加了一個「後生成宏」與

「C:\ Program Files文件(x86)的\ Microsoft Visual Studio 10.0 \ Common7 \ IDE \ MSTest.exe「/ testcontainer:」$(TargetPath)「

很好用,但是當出現錯誤時,我得到的只是一個退出代碼,是否有更好的方法可以做這個?

回答

2
  1. 打開宏IDE(工具>宏>宏IDE)。
  2. 打開EnvironmentEvents模塊。
  3. 添加以下代碼:

Private Sub BuildEvents_OnBuildDone(ByVal Scope As EnvDTE.vsBuildScope, ByVal Action As EnvDTE.vsBuildAction) Handles BuildEvents.OnBuildDone 
    RunTests() 
End Sub 

Private Sub RunTests() 
    ' Only run tests if there were no errors during build. 
    If (DTE.ToolWindows.ErrorList.ErrorItems.Count = 0) Then 
     ' MSTest 
     DTE.ExecuteCommand("Test.RunAllTestsInSolution") 
     ' ReSharper 
     'DTE.ExecuteCommand("ReSharper.ReSharper_UnitTest_RunSolution") 
    End If 
End Sub 
+0

這很好,謝謝 – jaekie 2011-02-07 15:27:00

+0

很高興我能幫上忙。 – Jaguir 2011-02-07 16:56:56