Visual Studio 2010中我已經安裝了NUnit的,但它不是在VS 2010的工具菜單顯示請幫我NUnit的在工具選項
1
A
回答
0
在2010年VS Click here集成NUnit的。
0
您可以通過@Bili發現的將NUnit集成到VS 2010中。我更喜歡使用Resharper的測試跑步者(但這花費了很多錢)。 NCrunch是一個免費的插件(現在),它增強了NUnit的測試。除了運行單元測試之外,它還提供代碼覆蓋。我相信這是一個NuGet包。
0
我寫了一個運行NUnit的測試一些宏。 它應該是私人的,所以我有一些假設,它不是「乾淨」(我沒有長時間工作)......但如果你想跟隨他們,你可以得到一個非常舒適的方式來「整合「在VS測試
假設:
- 你必須在PATH環境變量
- 測試項目NUnit的bin文件夾‘someName’將在‘someName.Test’項目(集成測試 - 「someName.integration」)
如果你認爲它可能使你的工作容易使代碼是在這裏:
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports EnvDTE90a
Imports EnvDTE100
Imports System.Diagnostics
Imports System.Collections.Generic
Imports System.IO
Public Module NUnitExtensions
Sub AttachToNUnit()
Dim attached As Boolean = False
Dim proc As EnvDTE.Process
For Each proc In DTE.Debugger.LocalProcesses
If (Right(proc.Name.ToLower(), 9) = "nunit.exe") Then
proc.Attach()
attached = True
Exit For
End If
Next
End Sub
Private Sub RunNunitFile(ByRef dll)
Dim args = """" & dll & """" & " /run"
System.Diagnostics.Process.Start("nunit.exe", args)
End Sub
Private Function GetSolutionFiles(ByRef filePattern) As String()
Dim solutionDir = System.IO.Path.GetDirectoryName(DTE.Solution.FullName)
Dim nunitFiles = System.IO.Directory.GetFiles(solutionDir, filePattern, IO.SearchOption.AllDirectories)
Return nunitFiles
End Function
Private Function GetDllCompilationAttributes(ByRef dllFullPath) As Boolean()
Dim ActiveDoc As Document = DTE.ActiveDocument
Dim Proj As Project = ActiveDoc.ProjectItem.ContainingProject
Dim config As Configuration = Proj.ConfigurationManager.ActiveConfiguration
Dim result(2) As Boolean
result(0) = False
result(1) = False
Dim parts = Split(dllFullPath, "\")
For Each part As String In parts
If part.ToLower() = "obj" Then
result(1) = True
End If
If part.ToLower() = config.ConfigurationName.ToLower() Then
result(0) = True
End If
Next
Return result
End Function
Sub RunNUnit()
Dim nunitUnitTestFiles = GetSolutionFiles("*test.dll")
Dim nunitIntegrationTestFiles = GetSolutionFiles("*integration.dll")
Dim unitTestsAndIntegrationTestFiles As New List(Of String)
unitTestsAndIntegrationTestFiles.AddRange(nunitUnitTestFiles)
unitTestsAndIntegrationTestFiles.AddRange(nunitIntegrationTestFiles)
For Each dll As String In unitTestsAndIntegrationTestFiles
Dim dllAttributes = GetDllCompilationAttributes(dll)
Dim debug = dllAttributes(0)
Dim obj = dllAttributes(1)
If debug AndAlso Not obj Then
RunNunitFile(dll)
End If
Next
End Sub
Sub RunCurrentProjectNUnit()
Dim ActiveDoc As Document = DTE.ActiveDocument
Dim Proj As Project = ActiveDoc.ProjectItem.ContainingProject
Dim config As Configuration = Proj.ConfigurationManager.ActiveConfiguration
Dim projectFileName = Proj.FullName
Dim projectPath = Path.GetDirectoryName(projectFileName)
Dim dllName = Proj.Name
If (Not projectPath.ToLower().EndsWith(".test")) Then
projectPath += ".Test"
dllName += ".Test"
End If
Dim testDllPath = String.Format("{0}\bin\{1}\{2}.dll", projectPath, config.ConfigurationName, dllName)
RunNunitFile(testDllPath)
End Sub
End Module
確保,如果你把它添加到宏窗口(按Alt + F8),你必須命名代碼文件「NUnitExtensions」,然後你可以將這些宏添加爲工具欄按鈕,例如
0
Visual NUnit擴展名非常有幫助;它增加了一個運行NUnit測試的工具箱。
相關問題
- 1. 是從NUnit 3.0.1中刪除的NUnit窗口測試工具
- 2. 在Android工作室的主工具欄的選項菜單中添加選項
- 3. nunit控制檯的Noshadow選項
- 4. 問題關於NUNIT測試工具
- 5. NUnit:「夾具」 - ?
- 6. 工具提示選擇框選項
- 7. 小工具。類型爲url的首選項Google小工具
- 8. Android:工具欄中的選項卡
- 9. jQuery工具選項卡 - 命名的錨?
- 10. jEasyUI,選項卡中的工具欄
- 11. 沒有BWToolkit的首選項工具欄
- 12. 在Netbeans的c/C++工具選項中添加Qmake命令選項
- 13. jQuery工具選項卡+表格
- 14. jQuery工具選項卡嵌套控件?
- 15. 小工具:存儲用戶首選項
- 16. jquery工具選項卡速度
- 17. 禁用工具提示選項卡
- 18. 地理工具和其他選項?
- 19. 自動完成工具命令選項
- 20. ChartJS - 傳說和工具提示選項
- 21. ArcSDE數據庫重構工具選項
- 22. Android工具欄選項卡導航
- 23. 谷歌圖表工具提示選項
- 24. jquery工具多個選項卡?
- 25. jQuery工具選項卡:如何禁用選項卡
- 26. jQuery UI選項卡+ jQuery工具選項卡(Flowplayer)衝突
- 27. 工具提示上的Angulerjs伍選項生成的選擇框選項
- 28. 不能得到flexigrid工作在jquery工具選項卡
- 29. 在Chrome開發工具中拆分「元素」選項卡和「控制檯」工具
- 30. jQuery選擇具有「選擇」在選項
你安裝了什麼軟件包? –