F# NUnit 测试返回未 运行
F# NUnit test comes back as not being run
我正在与 VS 2013
、F#
和 NUnit
合作。值得注意的是我是 F#
的新手。
我添加了非常基本的测试,当我将调试器附加到 NUnit
和 运行 时,它在调试模式断点被击中,但测试返回时没有 运行。
NUnit
将其标识为测试但不 运行(假设)Assert
(可以在底部屏幕截图中看到)。
测试:
module Test
open NUnit.Framework
[<TestFixture>]
type Test() =
[<Test>]
let ConcatinationTest =
Assert.AreEqual(Implementation.Concat("aaa"), "rootaaa")
|> ignore
实施:
module Implementation
let Concat(text:string) =
"root"+ text
我的预期一定是错误的。为什么不起作用?
OP 在这里,对于那些想知道这是否有效的人。
module Test
open NUnit.Framework
[<TestFixture>]
type Test() =
member this.ConcatinationTestData() =
[new TestCaseData("roottext","text"); new TestCaseData("root","")]
[<Test>]
[<TestCaseSource("ConcatinationTestData")>]
static member ConcatinationTest(expected:string, text:string) =
Assert.AreEqual(expected,Implementation.Concat(text))
|> ignore
调试 -> 附加到进程 -> nunit-agent.exe
结果:
您将其定义为一个值,但它必须是一个方法:
[<Test>]
static member ConcatinationTest () = ...
(根据 OP 的要求将评论转换为答案)
我正在与 VS 2013
、F#
和 NUnit
合作。值得注意的是我是 F#
的新手。
我添加了非常基本的测试,当我将调试器附加到 NUnit
和 运行 时,它在调试模式断点被击中,但测试返回时没有 运行。
NUnit
将其标识为测试但不 运行(假设)Assert
(可以在底部屏幕截图中看到)。
测试:
module Test
open NUnit.Framework
[<TestFixture>]
type Test() =
[<Test>]
let ConcatinationTest =
Assert.AreEqual(Implementation.Concat("aaa"), "rootaaa")
|> ignore
实施:
module Implementation
let Concat(text:string) =
"root"+ text
我的预期一定是错误的。为什么不起作用?
OP 在这里,对于那些想知道这是否有效的人。
module Test
open NUnit.Framework
[<TestFixture>]
type Test() =
member this.ConcatinationTestData() =
[new TestCaseData("roottext","text"); new TestCaseData("root","")]
[<Test>]
[<TestCaseSource("ConcatinationTestData")>]
static member ConcatinationTest(expected:string, text:string) =
Assert.AreEqual(expected,Implementation.Concat(text))
|> ignore
调试 -> 附加到进程 -> nunit-agent.exe
结果:
您将其定义为一个值,但它必须是一个方法:
[<Test>]
static member ConcatinationTest () = ...
(根据 OP 的要求将评论转换为答案)