|
测试用例中的代码:
using System;
using NUnit.Framework;
using NUnitTest;
namespace NUnitTestTest
{
[TestFixture]
public class CalculatorTest
{
private Calculator cal;
private int a, b, expected, actual;
[TestFixtureSetUp]
public void InitClass()
{
cal = new Calculator();
a = 10;
b = 2;
}
[TestFixtureTearDown]
public void FinalizeClass()
{
Console.WriteLine("执行TestFixtureTearDown");
}
[Test]
public void TestAdd()
{
Console.WriteLine("TestAdd() Begin");
expected = 12;
actual = cal.Add(a, b);
Assert.AreEqual(expected, actual);
Console.WriteLine("TestAdd() End");
}
[Test]
public void TestMinus()
{
Console.WriteLine("TestMinus Begin");
expected = 8;
actual = cal.Minus(a,b);
Assert.AreEqual(expected, actual);
Console.WriteLine("TestMinus End");
}
[Test]
public void TestMultiply()
{
Console.WriteLine("TestMultiply() Begin");
expected = 20;
actual = cal.Multiply(a, b);
Assert.AreEqual(expected, actual);
Console.WriteLine("TestMultiply() End");
}
[Test]
public void TestDivide()
{
Console.WriteLine("TestDivide() Begin");
expected = 5;
actual = cal.Divide(a, b);
Assert.AreEqual(expected, actual);
Console.WriteLine("TestDivide() End");
}
}
}
把上面这段代码编译好后取其.dll文件,在NUnit中打开看到的次序是:
TestAdd
TestDivide
TestMinus
TestMultiply
而且执行用例的默认次序也是按这个来的
请问怎么样设置使之用例的次序按代码中的次序来排列呢?这里是按a到z的次序自动排列的吗? |
|