简体   繁体   English

使用 dotCover 的代码覆盖率 - FAKE F#MAKE

[英]Code coverage using dotCover - FAKE F#MAKE

I am trying to use dotCover in FAKE .I am getting an error ie DotCoverNUnit is not defined .I think this is the problem with the package .我正在尝试在 FAKE 中使用 dotCover。我收到一个错误,即DotCoverNUnit is not defined 。我认为这是包的问题。

Here is my Code for DotCover in FAKE :这是我在 FAKE 中的 DotCover 代码:

let filters = ""
Target "TestCoverage" (fun _ ->
    !! ("D:/Test/Project/Project1/UnitTests/UnitTest.dll")
        |> DotCoverNUnit (fun p -> 
            { p with
                Output = testDir @@ "NUnitDotCover.snapshot"
                Filters = filters }) nunitOptions
)

Please tell me how to install DotCover in Fake or how to use this .请告诉我如何在 Fake 中安装 DotCover 或如何使用它。 This would be very helpful .这将非常有帮助。

The Fake.DotCover module is not auto-opened, so its functions aren't available until you do open Fake.DotCover near the top of your script. Fake.DotCover模块不会自动打开,因此在您open Fake.DotCover脚本顶部附近的open Fake.DotCover之前,它的功能不可用。

Unfortunately, the FAKE API documentation currently isn't very good at telling you which modules are auto-opened and which ones need open (modulename) in order to expose their functions.不幸的是,FAKE API 文档目前并不能很好地告诉您哪些模块是自动打开的,哪些模块需要open (modulename)以公开它们的功能。

Update: The way you should be calling DotCoverNUnit is as follows:更新:您应该调用DotCoverNUnit方式如下:

let filters = ""
Target "TestCoverage" (fun _ ->
    !! ("D:/Test/Project/Project1/UnitTests/UnitTest.dll")
        |> DotCoverNUnit
            (fun p -> { p with Output = testDir @@ "NUnitDotCover.snapshot"
                               Filters = filters })
            (fun nunitOptions -> nunitOptions)
)

Or, if you want to change some of the NUnit options:或者,如果您想更改一些 NUnit 选项:

let filters = ""
Target "TestCoverage" (fun _ ->
    !! ("D:/Test/Project/Project1/UnitTests/UnitTest.dll")
        |> DotCoverNUnit
            (fun dotCoverOptions ->
                 { dotCoverOptions with Output = testDir @@ "NUnitDotCover.snapshot"
                                        Filters = filters })
            (fun nunitOptions ->
                 { nunitOptions with ExcludeCategory = "Manual,LongRunning"
                                     DisableShadowCopy = true })
)

See http://fsharp.github.io/FAKE/apidocs/fake-nunitcommon-nunitparams.html for the complete list of what NUnit options are available from inside FAKE.有关 FAKE 内部可用的 NUnit 选项的完整列表,请参阅http://fsharp.github.io/FAKE/apidocs/fake-nunitcommon-nunitparams.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM