日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

在Visual Studio 2010 里使用Nunit 进行Debug 测试

發布時間:2025/4/5 38 豆豆
生活随笔 收集整理的這篇文章主要介紹了 在Visual Studio 2010 里使用Nunit 进行Debug 测试 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1. 創建帶測試類庫的項目解決方案(詳細方法參見Nunit Quick Start),如圖:

?

下面一個是供Nunit 進行單元測試的。

2 選中測試類庫,鼠標右鍵選擇屬性,調試

在啟動操作 選項中,選擇啟動外部程序,并設置好Nunit 單元測試 Nunit.exe程序位置

3 打開 Nunit 安裝目錄,找到Nunit.exe.config

修改配置文件如下:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
? <!--
?? The GUI only runs under .NET 2.0 or higher. The
?? useLegacyV2RuntimeActivationPolicy setting only
?? applies under .NET 4.0 and permits use of mixed
?? mode assemblies, which would otherwise not load
?? correctly.
? -->
? <startup useLegacyV2RuntimeActivationPolicy="true">
??? <!-- Comment out the next line to force use of .NET 4.0
??? <supportedRuntime version="v2.0.50727" />
??? <supportedRuntime version="v4.0.30319" /> -->
??? <requiredRuntime version="v4.0.30319" /> <!--添加該行配置,并只留這一個配置-->
? </startup>
? <runtime>
??? <!-- Ensure that test exceptions don't crash NUnit -->
??? <legacyUnhandledExceptionPolicy enabled="1" />

??? <!-- Run partial trust V2 assemblies in full trust under .NET 4.0 -->
??? <loadFromRemoteSources enabled="true" />? <!--該項配置為true-->
??? <!-- Look for addins in the addins directory for now -->
??? <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
????? <probing privatePath="lib;addins" />
??? </assemblyBinding>

? </runtime>

</configuration>

?

4? 為要測試的方法打上斷點,選中測試類庫為啟動項,按F5運行

??

在Nunit 界面上運行要測試的方法,成功在斷點上停下來

轉載于:https://www.cnblogs.com/iampkm/archive/2012/10/10/2718088.html

總結

以上是生活随笔為你收集整理的在Visual Studio 2010 里使用Nunit 进行Debug 测试的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。