简体   繁体   中英

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 .

Here is my Code for DotCover in FAKE :

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 . 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.

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.

Update: The way you should be calling DotCoverNUnit is as follows:

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:

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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