Jim Reineri
Jim Reineri

Reputation: 2980

Cannot run MSTest in FAKE build script

I have a FAKE script that is attempting to run MSTest. I am getting a 'Not Defined' error on MSTest. From what I can gather in the documentation the MSTest helper should be in FakeLib.dll and in the 'Fake' namespace. Is that wrong?

Why would I be getting this error?

#I "packages/FAKE/tools"
#r "packages/FAKE/tools/FakeLib.dll"
open Fake

...  many build steps working fine

Target "UnitTest" (fun _ ->
    trace "Run Unit Tests..."
    !! (testDir @@ "*.Tests.dll")
      |> MSTest (fun p -> { p })
    ()
)

Upvotes: 0

Views: 69

Answers (1)

Alex M
Alex M

Reputation: 2548

I had to include the open Fake.MSTest. Below is the snippet I use for unit tests.

open Fake.MSTest

Target "UnitTests" (fun _ ->
    let msTestParams p =
        { p with
            ResultsDir = resultsDir
            WorkingDir = testOutDir
            TestSettingsPath = sd @@ "Local.testsettings"
            ErrorLevel = ErrorLevel.Error
            NoIsolation = false }

    !! (testOutDir + @"\*.Tests.dll")
    |> MSTest msTestParams
)

Upvotes: 1

Related Questions