gpt4 book ai didi

visual-studio - 为什么 NUnit 测试适配器找不到我的 FsUnit 测试?

转载 作者:行者123 更新时间:2023-12-04 03:50:00 25 4
gpt4 key购买 nike

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

它没有发现任何有关构建以下代码的测试:

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# 交互中运行良好。

如何让测试出现在测试资源管理器中?

最佳答案

我有同样的问题,而且很容易制作。

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

一个用于 2.x:NUnit Test Adapter

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

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 Test Adapter

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

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

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

关于visual-studio - 为什么 NUnit 测试适配器找不到我的 FsUnit 测试?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37297238/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com