Can't get OpenCover to work fake
EDITED to show the ignore return as Fedor pointed out and the error you received
I have a file .fsx
with multiple targets that work as expected, but I cannot get the target to OpenCover
work. This is what I have for the target code:
Target "Coverage" (fun _ ->
OpenCover
(fun p -> { p with ExePath = "./packages/OpenCover.4.6.519/tools/OpenCover.Console.exe"
TestRunnerExePath = "./packages/Machine.Specifications.Runner.Console.0.10.0-Unstable0005/tools/mspec-clr4.exe"
Output = reportDir + "MspecOutput.xml"
Register = "-register:user"
}
)
testDir @@ "FakeTest2UnitTesting.dll" + "--xml " + reportDir + "MspecOutput.xml" |> ignore
)
But now I am getting the following build error:
build.fsx (45.3): Error FS0039: The value or constructor "OpenCover" is not defined. Perhaps you need one of the following: OpenCoverHelper NCover
I don't know what I am doing wrong. Can anyone show me how to use the OpenCoverHelper from the FAKE API ? Thanks to
source to share
After playing a lot around playing Google, I finally came up with a solution. The main problem was that I didn't open OpenCoverHelper
. I made the assumption that it was included in FAKE as well as Api and there was no documentation to say anything else. So, here's the code I'm using:
// include Fake lib
#r @"packages/FAKE.4.61.2/tools/FakeLib.dll"
open Fake
open Fake.OpenCoverHelper
Target "Coverage" (fun _ ->
OpenCover (fun p -> { p with
ExePath = "./packages/OpenCover.4.6.519/tools/OpenCover.Console.exe"
TestRunnerExePath = "./packages/Machine.Specifications.Runner.Console.0.10.0-Unstable0005/tools/mspec-clr4.exe"
Output = "./report/MspecOutput.xml"
Register = RegisterUser
})
"./test/FakeTest2UnitTesting.dll + --xml ./report/MspecOutput.xml"
)
Hope this helps someone in the future.
source to share