首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在NUnit中实现TestSuite

在NUnit中实现TestSuite
EN

Stack Overflow用户
提问于 2013-03-23 03:22:03
回答 1查看 4.4K关注 0票数 2

我一直在想:

代码语言:javascript
复制
The type or namespace name 'TestSuite' could not be found (are you missing a using directive or an assembly reference?)

我使用的是visual studio 2010,我已经通过NuGet安装了最新的NUnit和selenium参考资料。代码如下:

代码语言:javascript
复制
using NUnit.Framework;

namespace SeleniumTests
{
    public class ManifestTestSuite
    {
        [Suite] 
        public static TestSuite Suite
        {
            get
            {
                TestSuite suite = new TestSuite("MyTestSuite");
                suite.Add(new AddAll());
                suite.Add(new RemoveAll());
                return suite;
            }
        }
    }
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-03-23 03:52:17

TestSuite类位于nunit.core.dll中,它不随nuget包一起分发,因为通常不需要它。

因此,您需要从the NUnit website下载“完整的”nunit包,您可以在压缩文件内的nunit.core.dll文件夹中找到nunit。

但是,您不需要这样做,因为从2.4.4开始有一种新方法,如documenation中所述:您可以返回测试数组,而不是实例TestSuite

代码语言:javascript
复制
[Suite] 
public static IEnumerable Suite
{
    get
    {
        ArrayList suite = new ArrayList();
        suite.Add(new AddAll());
        suite.Add(new RemoveAll());
        return suite;
    }
}
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15578288

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档