为什么NUnit测试适配器找不到我的FsUnit测试? [英] Why can't the NUnit Test Adapter find my FsUnit tests?

查看:76
本文介绍了为什么NUnit测试适配器找不到我的FsUnit测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Visual Studio Professional 2015,并且已安装NUnit测试适配器的版本2.0.0.0.

I'm using Visual Studio Professional 2015 and I have version 2.0.0.0 of the NUnit Test Adapter installed.

在构建以下代码时未发现任何测试:

It doesn't discover any tests on building the following code:

namespace SmallestDivisibleIntegers

module Core =

    let f n = [2..4] |> List.map (fun x -> x + n - n % x)

module Tests =

    open FsUnit
    open NUnit.Framework

    open Core

    [<Test>]
    let ``Correct answers`` () =
        f 1 |> should equal [2; 3; 4]
        f 4 |> should equal [6; 6; 8]
        f 43 |> should equal [44; 45; 44]
        f 123 |> should equal [124; 126; 124]
        f 420 |> should equal [422; 423; 424]
        f 31415 |> should equal [31416; 31416; 31416]
        f 1081177 |> should equal [1081178; 1081179; 1081180]

    [<Test>]
    let ``simple test`` () =
        (1 + 1) |> should equal 2

我引用了FsUnit(2.1.0)和NUnit(3.2.0),并且测试在F#交互式环境中运行良好.

I have referenced FsUnit (2.1.0) and NUnit (3.2.0) and the tests run fine in F# interactive.

如何使测试显示在测试资源管理器"中?

How can I get the tests to appear in the Test Explorer?

推荐答案

我遇到了同样的问题,而且很容易制作.

I had the same problem and it is easy to make.

您预先假设只有一个NUnit Test Adapter,并且它适用于NUnit的2.x和3.x版本.但是,NUnit Test Adapter

You are pre-supposing that there is only one NUnit Test Adapter and that it works for versions 2.x and 3.x of NUnit. However there are two versions of the NUnit Test Adapter

一个2.x版本: NUnit测试适配器

NUnitTestAdapter扩展与Visual Studio单元测试一起使用 允许在Visual Studio 2012下执行集成测试的窗口, 2013和2015.

The NUnitTestAdapter extension works with the Visual Studio Unit Test window to allow integrated test execution under Visual Studio 2012, 2013 and 2015.

最新版本2.0是基于NUnit 2.6.4并兼容的 使用NUnit 2.0到2.6.4开发的测试.它支持所有 VS2012,VS2013和VS2015版本. 您可以在此处

The latest version, 2.0, is based on NUnit 2.6.4 and is compatible with tests developed using NUnit 2.0 through 2.6.4. It supports all versions of VS2012, VS2013 and VS2015. You can find the release notes here

和3.x版本之一: NUnit3测试适配器

NUnit3TestAdapter扩展与Visual Studio单元测试一起使用 允许在Visual Studio 2012下执行集成测试的窗口, 2013和2015.

The NUnit3TestAdapter extension works with the Visual Studio Unit Test window to allow integrated test execution under Visual Studio 2012, 2013 and 2015.

此适配器仅适用于NUnit 3.0.与早期版本一起使用 NUnit使用NUnitTestAdapter(注释-否3)扩展名.

This adapter only works with NUnit 3.0. For use with earlier versions of NUnit use the NUnitTestAdapter (note - no 3) extension.

当前软件包是的3.0版的第一个正式版. 适配器,使用NUnit 3.0.1.您可以找到文档和 发行说明位于 https://github.com/nunit/docs/wiki

The current package is the first production release of version 3.0 of the adapter, using NUnit 3.0.1. You can find the documentation and release notes at https://github.com/nunit/docs/wiki

这篇关于为什么NUnit测试适配器找不到我的FsUnit测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆