亚洲好骚综合-亚洲黄色录像-亚洲黄色网址-亚洲黄色网址大全-99久久99久久-99久久99久久精品国产

您的位置:軟件測(cè)試 > 開源軟件測(cè)試 > 開源單元測(cè)試工具 > Nunit
NUnit學(xué)習(xí)筆記
作者:網(wǎng)絡(luò)轉(zhuǎn)載 發(fā)布時(shí)間:[ 2013/3/20 15:10:20 ] 推薦標(biāo)簽:
 

    Ignore屬性,忽略測(cè)試,可以供類和方法使用,用于忽略暫時(shí)不想運(yùn)行的測(cè)試用例。
    示例1:
    VB代碼:
<TestFixture(), Ignore("class test ignore")> _
Public Class Test
<Test()> _
Public Sub TestIgnore()
End Sub
 
<Test()> _
Public Sub TestIgnore2()
End Sub
End Class
    C#代碼:
        [TestFixture]
[Ignore("class test ignore")]
class Test
{
[Test]
public void TestIgnore()
{}
 
[Test]
public void TestIgnore2()
{}
}
    J#代碼:
/** @attribute TestFixture() */
/** @attribute Ignore("class test ignore") */
public class Test
{
/** @attribute Test() */
public void TestIgnore()
{}
 
/** @attribute Test() */
public void TestIgnore2()
{}
}
測(cè)試效果:NUnit-GUI狀態(tài)條為黃色。
示例2:
VB代碼:
        <TestFixture()> _
Public Class Test
<Test(), Ignore("function test ignore")> _
Public Sub TestIgnore()
End Sub
 
<Test()> _
Public Sub TestIgnore2()
End Sub
End Class
C#代碼:
        [TestFixture]
class Test
{
[Test]
[Ignore("function test ignore")]
public void TestIgnore()
{}
 
[Test]
public void TestIgnore2()
{}
}
J#代碼:
        /** @attribute TestFixture() */
public class Test
{
/** @attribute Test() */
/** @attribute Ignore("function test ignore") */
public void TestIgnore()
{}
 
/** @attribute Test() */
public void TestIgnore2()
{}
}
測(cè)試效果:NUnit-GUI狀態(tài)條為黃色,但與方法TestIgnore2對(duì)應(yīng)的節(jié)點(diǎn)顯示為綠色。由于本例僅忽略了方法TestIgnore,而這并不會(huì)影響TestIgnore2,因此TestIgnore2依然會(huì)正常運(yùn)行。
 
    Suite屬性。根據(jù)NUnit文檔的說(shuō)明,Suite屬性是用來(lái)標(biāo)記返回類型為NUnit.Core.TestSuite的類屬性成員的,該類屬性成員所返回的對(duì)象會(huì)包含一組測(cè)試類,也是說(shuō)Suite屬性其實(shí)是用來(lái)組織一組測(cè)試類的。那么組織這些測(cè)試類到TestSuite對(duì)象中有何用呢?其實(shí)在早期的NUint當(dāng)中,提供有NUnit.TextUI.TestRunner類,該類有個(gè)Run方法,參數(shù)是TestSuite對(duì)象,通過(guò)該方法可以在代碼中調(diào)用NUnit環(huán)境,從而運(yùn)行TestSuite對(duì)象中的測(cè)試類。不過(guò)現(xiàn)在NUnit似乎已經(jīng)不再使用這種方式了,故此對(duì)于Suite屬性這里不再介紹。
 
    Category屬性,分組測(cè)試,用于將測(cè)試類和測(cè)試方法分組,從而使測(cè)試類和測(cè)試方法可以按組進(jìn)行測(cè)試。
    示例:
VB代碼:
<TestFixture(), Category("class1")> _
Public Class Class11
<Test()> _
Public Sub Test()
End Sub
End Class
 
<TestFixture(), Category("class1")> _
Public Class Class12
<Test()> _
Public Sub Test()
End Sub
End Class
 
<TestFixture(), Category("class2")> _
Public Class Class21
<Test()> _
Public Sub Test()
End Sub
End Class
 
<TestFixture(), Category("class2")> _
Public Class Class22
<Test()> _
Public Sub Test()
End Sub
End Class
 
<TestFixture()> _
Public Class Class3
<Test(), Category("function1")> _
Public Sub Test11()
End Sub
 
<Test(), Category("function1")> _
Public Sub Test12()
End Sub
 
<Test(), Category("function2")> _
Public Sub Test21()
End Sub
 
<Test(), Category("function2")> _
Public Sub Test22()
End Sub
End Class
C#代碼:
[TestFixture]
[Category("class1")]
class Class11
{
[Test]
public void Test()
{}
}
 
[TestFixture]
[Category("class1")]
class Class12
{
[Test]
public void Test()
{}
}
 
[TestFixture]
[Category("class2")]
class Class21
{
[Test]
public void Test()
{}
}
 
[TestFixture]
[Category("class2")]
class Class22
{
[Test]
public void Test()
{}
}
 
[TestFixture]
class Class3
{
[Test]
[Category("function1")]
public void Test11()
{}
 
[Test]
[Category("function1")]
public void Test12()
{}
 
[Test]
[Category("function2")]
public void Test21()
{}
 
[Test]
[Category("function2")]
public void Test22()
{}
}
J#代碼:
/** @attribute TestFixture() */
/** @attribute Category("class1") */
public class Class11
{
/** @attribute Test() */
public void Test()
{}
}
 
/** @attribute TestFixture() */
/** @attribute Category("class1") */
public class Class12
{
/** @attribute Test() */
public void Test()
{}
}
 
/** @attribute TestFixture() */
/** @attribute Category("class2") */
public class Class21
{
/** @attribute Test() */
public void Test()
{}
}
 
/** @attribute TestFixture() */
/** @attribute Category("class2") */
public class Class22
{
/** @attribute Test() */
public void Test()
{}
}
 
/** @attribute TestFixture() */
public class Class3
{
/** @attribute Test() */
/** @attribute Category("function1") */
public void Test11()
{}
 
/** @attribute Test() */
/** @attribute Category("function1") */
public void Test12()
{}
 
/** @attribute Test() */
/** @attribute Category("function2") */
public void Test21()
{}
 
/** @attribute Test() */
/** @attribute Category("function2") */
public void Test22()
{}
}

上一頁(yè)1234567下一頁(yè)
軟件測(cè)試工具 | 聯(lián)系我們 | 投訴建議 | 誠(chéng)聘英才 | 申請(qǐng)使用列表 | 網(wǎng)站地圖
滬ICP備07036474 2003-2017 版權(quán)所有 上海澤眾軟件科技有限公司 Shanghai ZeZhong Software Co.,Ltd
主站蜘蛛池模板: 色综合视频在线观看 | 就爱干草视频 | 小嫩嫩精品导航 | 色香影视| 国产高清啪啪 | 日本高清h色视频在线观看 日本妇人成熟免费观看18 | 免费看黄色大片 | 久久午夜免费视频 | 特级黄色视频毛片 | 国产系列在线播放 | 一级一级一级毛片免费毛片 | 欧美在线成人午夜影视 | 日本美女影院 | 免费色视频 | 成人在线观看午夜 | 久草手机在线 | 欧美精品三级在线 | 永久黄网站色视频免费观看99 | 黄色国产在线视频 | 在线视频一二三区 | 在线免费成人 | 日本一区二区高清 | 国产福利影院 | 51成人网| 日本在线观看a | 999精品国产 | 精品日韩在线 | 日日噜噜噜夜夜爽爽狠狠69 | 在线视频日韩精品 | 亚洲成综合人影院在院播放 | 日韩一区二区三区视频在线观看 | 欧美一级高清黄图片 | 成人一区二区免费中文字幕 | 黄色a三级三级三级免费看 黄色a三级免费看 | 91po国产在线精品免费观看 | 日本亚洲欧美美色 | 日韩高清网站 | 成人黄漫画免费观看网址 | 亚洲国产精品一区二区久 | 日产国产欧美韩国在线 | 日韩欧美在线观看成人 |