2011-01-26 25 views
1

目前我有nunit的gui测试结构设置使用自动命名空间套件。Nunit Gui测试结构中的分组方法

我想知道是否可以在TestFixture内部组合方法名称。

目前,树看起来像

MyClassTest 
+Method-1 test1 
+Method-1 test2 
+Method-1 test3 
+Method-2 test1... 

我在想,如果有可能有树的样子

MyClassTest 
+Method1 
    ++Method-1 Test1 
    ++Method-1 Test2 
    ++Method-1 Test3 
+Method2 
    ++Method-2 Test1 

我为什么要这么做?这是因为我想选择“Method-1”节点并让它运行该方法的所有测试。我只是节省了检查该方法所有测试的问题。

背景:使用vb.net与vs2010 pro。

编辑:如果我创建一个类里面的“MYCLASS”称为“方法一”,我得到以下

MyClassTest 
+Method-2 test1 
MyCalssTest+Method-1 
    +Test1 
    +Test2 

回答

2

我通过创建一个Method1测试夹具类和具有Method1Test1,Method1Test2等做到这一点。测试功能作为该类的成员。例如。 (在C#中)

[TestFixture] 
public class Method1 
{ 
    [Test] 
    public void Method1Test1() 
    { 
     ... 
    } 

    [Test] 
    public void Method1Test2() 
    { 
     ... 
    } 
} 
+0

我在“Myclass”中创建了一个名为Method1的新类,而不是树中“Myclass”节点的子节点;它成为名为MyBranch + Method1的姐妹分支。 – Lareau 2011-01-26 13:21:31

+3

使Myclass成为一个命名空间,并将所有Method1,Method2等类放入其中 - 您将获得所需的内容。 – 2011-01-26 13:23:49

1

NUnit的Category属性也可能有帮助。