河北工业大学-软件测试Nunit介绍.pptVIP

  • 3
  • 0
  • 约2.64千字
  • 约 44页
  • 2017-04-26 发布于河南
  • 举报
河北工业大学-软件测试Nunit介绍

;NUnit介绍;硼秤契溢父阴玖添乃廉尧桅吗褥借耻曲瘴挟秧迁姓稀陪任菱侧窖菠层户捞河北工业大学软件测试Nunit介绍河北工业大学软件测试Nunit介绍;;;File主菜单;;using System; public class Cmp { public static int Largest(int[] list) { int index, max=Int32.MaxValue; for (index = 0; index list.Length-1; index++) { if (list[index] max) { max = list[index]; } } return max; } };;using System; public class Cmp { public static int Largest(int[] list) { int index, max=Int32.MaxValue; if (list.Length == 0) { throw new ArgumentException(Empty list); } for (index = 0; index list.Length-1; index++) { if (list[index] max) { max = list[index]; } } return max; } };using NUnit.Framework; [TestFixture] public class TestLargest { [Test] public void LargestOf3() { Assert.AreEqual(9, Cmp.Largest(new int[] {8,9,7})); } } ;TestFixture Attribute;Test Attribute;Assert;;测试代码和产品代码;测试代码必须做的几件事;;NUnit断言;AreEqual;AreEqual---floating point numbers;IsNull;AreSame;IsTrue;IsFalse;Fail;使用断言;NUnit Framework;Test Suite;Test Suite;Category 属性;using NUnit.Framework; using NUnit.Core; [TestFixture] public class TestShortestPath { [Test] [Category(Short)] public void Use5Cities() { TSP tsp = new TSP(); // Load with default cities Assert.AreEqual(140, tsp.ShortestPath(5)); } [Test, Category(Short)] // Can specify either way public void Use10Cities() { TSP tsp = new TSP(); // Load with default cities Assert.AreEqual(586, tsp.ShortestPath(10)); } // This one takes a while... [Test] [Category(Long)] public void Use50Cities() { TSP tsp = new TSP(); // Load with default cities Assert.AreEqual(2300, tsp.ShortestPath(50)); } } ;绢隅产勋焊戍鲍沮复囊烙乡遵乘涣翻捏宠烟谐娩鹃奋逐耗但萧棚杯伟遗续河北工业大学软件测试Nunit介绍河北工业大学软件测试Nunit介绍;;using NU

文档评论(0)

1亿VIP精品文档

相关文档