3

I'm a maintainer for FSharp.Charting. Recently our FAKE testing rules started breaking with the error reported below (specifically I'm calling build.cmd RunTests). FAKE seems to be picking up the incorrect path and exe name for nunit-console, which is at packages/NUnit.ConsoleRunner/tools/nunit3-console.exe. I'm not sure whether this is a versioning issue or if I need to update my build.fsx script to account for changes to FAKE and/or NUnit. Any guidance would be appreciated.

System.Exception: Start of process c:\GitHub\FSharp.Charting_20180310\tools\Nunit\nunit-console.exe failed. The system cannot find the file specified
at Fake.ProcessHelper.ExecProcessWithLambdas@91-16.Invoke(String message) in C:\code\fake\src\app\FakeLib\ProcessHelper.fs:line 91
at Fake.ProcessHelper.ExecProcessWithLambdas(FSharpFunc2 configProcessStartInfoF, TimeSpan timeOut, Boolean silent, FSharpFunc2 errorF, FSharpFunc2 messageF) in C:\code\fake\src\app\FakeLib\ProcessHelper.fs:line 91 
at Fake.NUnitSequential.NUnit(FSharpFunc2 setParams, IEnumerable1 assemblies) in C:\code\fake\src\app\FakeLib\UnitTest\NUnit\Sequential.fs:line 26 
at FSI_0005.Build.clo@113-10.Invoke(Unit _arg6) at Fake.TargetHelper.runSingleTarget(TargetTemplate1 target) in C:\code\fake\src\app\FakeLib\TargetHelper.fs:line 626

Some relevant contents of paket.lock:

FAKE (4.61.3) - framework: net40, net45, net461
NUnit (3.7.1) - framework: net40, net45, net461
NUnit.ConsoleRunner (3.6.1) - framework: net40, net45, net461
NUnit.Runners (3.6.1) - framework: net40, net45, net461
NUnit.ConsoleRunner (>= 3.6.1) - framework: net40, net45, net461

EDIT: fixed the build.cmd test command, and provided the explicit nunit-console path.

Robert Sim
  • 1,428
  • 11
  • 22
  • 1
    Looks like you need to set the `ToolPath` value explicitly in the `NUnitParameters` record, because it's different from the default path: https://fake.build/apidocs/fake-testing-nunit3.html – TeaDrivenDev Mar 20 '18 at 22:43
  • 1
    This is a pointer in the right direction. I set ToolPath to "packages/NUnit.ConsoleRunner/tools/" and now the error indicates it can't find nunit-console.exe, whereas NUnit.ConsoleRunner drops nunit3-console.exe. Note your linked doc relates to FAKE 5 and I have FAKE 4, even though there is no version specified in paket.dependencies. It sounds like I should either force FAKE 5 or force NUnit 2.x in paket.dependencies. Assuming nothing else breaks, FAKE 5 might be the better choice- I'm not sure why it's not already downloaded by default. – Robert Sim Mar 20 '18 at 22:59
  • @RobertSim FAKE 5 is currently pre-release, which is why paket resolves FAKE 4. – Charles Mager Mar 21 '18 at 08:12

1 Answers1

1

Per additional comments from @Charles Mager, there are two potential solutions:

  1. Thanks to @TeaDrivenDev I figured out there's a version misalignment between FAKE (v4) and NUnit which was unconstrained to download the latest v3 stable. This can be accomplished by clamping NUnit and NUnit.Runners in paket.dependencies to 2.6.3 or above, up to <3.0.

  2. Update build.fsx to use NUnit3. This involved open Fake.Testing and updating the NUnit call to NUnit3. In addition, some of the NUnit parameter names have been updated or deprecated. Full details of this approach can be found here.

I opted for solution 2 since it keeps us up to date with the current NUnit.

Robert Sim
  • 1,428
  • 11
  • 22
  • 2
    From a quick look in the FAKE 4 source, is there not an [`NUnit3` runner](https://github.com/fsharp/FAKE/blob/a69d21ad8973382d9555cd086dfd3b569f905da3/src/app/FakeLib/UnitTest/NUnit/NUnit3.fs#L301)? Try changing `NUnit` to `NUnit3` in your build script. – Charles Mager Mar 21 '18 at 07:36