單元測試01:nunit 安裝與代碼測試

1.nunit 下載與安裝

a.下載

下載地址:?http://nunit.org/download/

b.添加到系統環境變量

解壓下載包后,添加兩個路徑到環境變量,如:

D:\nunitD:\nunit\nunit-console

2.建立測試項目

a.建立class project

b.project 里reference添加 nunit.framework.dll。dll在下載包內

c.代碼編寫

namespace TestActPic
{ [TestFixture]public class TestActPic{private XmlDocument xmlDocument = new XmlDocument();private ActConfig config = new ActConfig();[SetUp]public void Setup(){Trace.Listeners.Add(new TextWriterTraceListener("log.txt"));Trace.AutoFlush = true;this.xmlDocument.Load(@"TestActPic.xml");}[Test]      public void TestConstructorRight(){            // .......ActBase CapPic = new ActePic(config);}[Test][ExpectedException]public void TestConstructorWithoutWindows(){           config.Node = xmlDocument.SelectSingleNode(@"//TestConstructor/ConstructorWithoutWindow/Act");Base CapPic = new ActPic(config);}[Test]public void TestWrong(){// Assert.AreEqual("test", this.title);DriverDiretory testr = new DriverDiretory(testPath[1]);List<string> list = new List<string>();Assert.AreEqual(false, testr.GetAllDriver(ref list));}}
}

3.測試

a.測試配置文件Test.nunit,修改assembly path=“....”

<NUnitProject><Settings activeconfig="Default" /><Config name="Default" binpathtype="Auto"><assembly path="./TestActPic.dll"/>    </Config>
</NUnitProject>

b.執行CMD

nunit3-console test.nunit --result=TestResult.xml

?

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/280911.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/280911.shtml
英文地址,請注明出處:http://en.pswp.cn/news/280911.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

如何將您的Google Authenticator憑證移至新的Android手機或平板電腦

Most of the app data on your Android is probably synced online will automatically sync to a new phone or tablet. However, your Google Authenticator credentials won’t — they aren’t synchronized for obvious security reasons. Android上的大多數應用程序數據可…

關于經緯度的兩個計算[Teaksxgluxv]

一、子午線周長(公里) 40008.548 赤道周長(公里) 40075.704 緯度40008.548 / 360(度) 111.135 公里/度40008.548 / (360*60)(分) 1.85 公里/分40008.548 / (360*60*60)(秒) 30.87 米/秒 經度首先算相應經度位置的緯度圈長度40075.704 * cos(經度)然后方法相同&#xff0c;除…

轉載通過 Docker 實現傳統應用程序的現代化

長期以來&#xff0c;IT 組織將其預算的 80% 用于簡單地維護現有應用程序&#xff0c;而只花費 20% 用于創新。 在過去的 10 年里&#xff0c;這一比例并沒有太大改觀。而同時又必須面對創新的壓力。無論是直接來自客戶的需求&#xff0c;要求提供新的功能&#xff0c;還是來自…

org.eclipse.jdt.internal.compiler包下的類找不到

到maven庫上下載jar包&#xff1a;org.eclipse.jdt.core-3.13.jar <!-- https://mvnrepository.com/artifact/org.eclipse.jdt/org.eclipse.jdt.core --><dependency> <groupId>org.eclipse.jdt</groupId> <artifactId>org.eclipse.jdt.core<…

單元測試02:Open-Cover安裝與使用

1.Open-Cover 用于測試代碼是否被測試過。 1.下載open-cover與ReportGenerator 2.下載壓縮包后&#xff0c;設置系統環境變量&#xff0c;如&#xff1a; D:\OpenCover D:\OpenCover\ReportGenerator2.執行 OpenCover.console -register -target:nunit3-console.exe -targ…

Blazor學習之旅 (6) 路由系統

【Blazor】| 總結/Edison Zhou大家好&#xff0c;我是Edison。許久沒有更新Blazor學習系列了&#xff0c;今天續更。Blazor 的路由系統就和 ASP.NET MVC的路由系統一樣&#xff0c;可以為我們提供靈活的選項&#xff0c;可用于確保用戶請求到達可處理它們并返回用戶想要的信息的…

kindle降級卡大樹_從提示框:Kindle購物流程圖,iOS降級和DIY焊接筆

kindle降級卡大樹Once a week we round up some of the tips from the HTG tips box and share them with the greater readership; this week we’re looking at shopping for Kindles with a flowchart, downgrading iOS, and rolling your own DIY soldering pen. 每周一次&…

MS CRM 2011 Form與Web Resource在JScript中的相互調用

原創地址&#xff1a;http://www.cnblogs.com/jfzhu/archive/2013/02/14/2912580.html 轉載請注明出處 在Form中可以添加一個html的web resource&#xff0c;在web resource里可以用JScript來使用REST Endpoint或者SOAD Endpoint。 你可以在Form中添加一個web resource&#xf…

判斷字符是否在1-15之間

var str $(#name).val();//獲取字符的value var reg /^\S{1,15}$/; //字符在1-15之間的正則 var flag reg.test(str); // 判斷字符與正則是否匹配 if(!flag){ //提示不滿足條件 }轉載于:https://www.cnblogs.com/yxl-java/p/8617661.html

從 .NET 6 更新到 .NET 7

Upgrade from .NET 6 to .NET 7Intro.NET 7 已經發布了一段時間了&#xff0c;將幾個服務升級到了 .NET 7&#xff0c;升級還是比較順利的&#xff0c;也有遇到幾個問題&#xff0c;分享一下TargetFramework首先我們需要將項目文件中的目標框架&#xff08;TargetFramework&…

MySQL-05:pymysql與pycharm設置

PyMySQL介紹 PyMySQL 是在 Python3.x 版本中用于連接 MySQL 服務器的一個庫&#xff0c;Python2中則使用mysqldb。 Django中也可以使用PyMySQL連接MySQL數據庫。 PyMySQL安裝 pip install pymysql 連接數據庫 前置條件&#xff1a; 已有一個MySQL數據庫&#xff0c;并且…

如何將前端數據保存到文件

有時候&#xff0c;網頁上需要提供將當前頁面上的數據導出為本地文件的功能&#xff0c;例如將頁面上的一個表格導出為csv文件。這個功能看似簡單&#xff0c;實際上卻沒有什么直接的方法。由于導出文件的操作&#xff08;比如瀏覽文件目錄&#xff0c;創建本地文件等&#xff…

hdmi-cec_如何使用HDMI-CEC使用PlayStation 4或Pro自動打開電視

hdmi-cecCall it petty, but there’s just something about eliminating the “turn on the TV” portion of firing up your PlayStation 4 that makes the whole process seem faster. And the good news is that getting this action on your setup is as easy and ticking…

Microsoft POS for .NET v1.12 發布了

Microsoft POS for .NET v1.12是一個類庫&#xff0c;它為你的.NET應用程序與POS設備的交互提供了一組簡單統一的接口。使得供應商能夠為常見的POS設備(如收銀機&#xff0c;掃描儀等)輕松開發出通用的應用程序&#xff0c;您可以在此處下載.POSv1.12的更新&#xff1a;與 UPOS…

【APP接口開發】常用HTTP響應頭狀態碼詳解

1、200 OK&#xff0c;客戶端請求城成功 2、400 Bad Request &#xff0c;客服端請求語法錯誤&#xff0c;服務器無法理解和處理 3、401 unauthorized&#xff0c;請求未通過認證 4、403 permission forbidden &#xff0c;無權限 5、404 URI不存在&#xff0c;訪問的資源不存在…

leetcode——Lowest Common Ancestor of a Binary Tree

題目 Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. 思路 這一次說的是一個普通的二叉樹&#xff0c;給出兩個節點。求他們的最低公共父節點。回憶一下&#xff0c;當這棵二叉樹是二分查找樹的時候的解決方式&#xff1a; 二分…

MySQL-06:pyMySQL增刪改查基本命令筆記

增 # 導入pymysql模塊 import pymysql # 連接database conn pymysql.connect(host“你的數據庫地址”, user“用戶名”,password“密碼”,database“數據庫名”,charset“utf8”) # 得到一個可以執行SQL語句的光標對象 cursor conn.cursor() sql "INSERT INTO USER1(n…

ABP Framework 7.0 RC 新增功能簡介

imageABP Framework 在架構上有四大目標&#xff1a;模塊化、DDD、多租戶和微服務。從 7.0 更新的功能來看&#xff0c;其側重點轉向微服務場景的實現&#xff0c;比如&#xff1a;Dapr 集成、動態權限和功能、外部本地化、分布式實體緩存服務&#xff0c;都是對微服務和分布式…

(原創) 07/28/1982 少女A (中森明菜)

Abstract明菜的第二首單曲&#xff0c;也是她的成名曲&#xff0c;在臺灣曾經被歌手嘟嘟翻唱過。 Introduction[hjp2400,300,true]http://oomusou.googlepages.com/shojo_a.flv[/hjp2] 明菜從『少女A』這首單曲才開始竄紅&#xff0c;走的也是可愛路線&#xff0c;招牌的『明菜…

ftp服務

1.ftp工作原理FTP是一個客戶機/服務系統。用戶通過一個支持FTP協議的客戶機程序&#xff0c;連接到在遠程主機上的FTP服務器程序。用戶通過客戶機程序向服務器程序發出命令&#xff0c;服務器程序執行用戶所發出的命令&#xff0c;并將執行的結果返回到客戶機。2.安裝ftp服務yu…