Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xunit runner fails on mono when it has to output an xml file #568

Closed
albertjan opened this issue Oct 16, 2014 · 2 comments
Closed

xunit runner fails on mono when it has to output an xml file #568

albertjan opened this issue Oct 16, 2014 · 2 comments

Comments

@albertjan
Copy link
Member

With this error:

Starting Target: RunTests (==> Build)
mono  ./packages/xunit.runners/tools/xunit.console.clr4.exe "/Users/albertjan/oxen/tests/oxen.Tests/bin/Release/oxen.Tests.dll" "/xml" "/Users/albertjan/oxen/oxen.Tests.dll.xml" 
xUnit.net console test runner (32-bit .NET 4.0.30319.17020)
Copyright (C) 2013 Outercurve Foundation.

error: missing filename for /xml
Running build failed.
Error:
System.Exception: xUnit failed for the following assemblies: /Users/albertjan/oxen/tests/oxen.Tests/bin/Release/oxen.Tests.dll
  at Fake.XUnitHelper+xUnit@124-1.Invoke (System.String message) [0x00000] in <filename unknown>:0 
  at Fake.XUnitHelper.xUnit (Microsoft.FSharp.Core.FSharpFunc`2 setParams, IEnumerable`1 assemblies) [0x00000] in <filename unknown>:0 
  at FSI_0001.Build+clo@126-9.Invoke (Microsoft.FSharp.Core.Unit _arg5) [0x00000] in <filename unknown>:0 
  at Fake.TargetHelper+targetFromTemplate@145[Microsoft.FSharp.Core.Unit].Invoke (Microsoft.FSharp.Core.Unit unitVar0) [0x00000] in <filename unknown>:0 
  at Fake.TargetHelper.runTarget@314 (System.String targetName) [0x00000] in <filename unknown>:0 
@sgr000
Copy link

sgr000 commented Dec 4, 2014

The exact same thing happens if you specify html output or if you specify nunit-style xml output. Apparently the command args being built are not being parsed properly when the underlying platform is mono, and hence unit tests can't run.

Here's the example showing the same bug with html output:

mono  ./packages/xunit.runners.1.9.2/tools/xunit.console.clr4.exe "./build/test/Hello-FSharp-tests.dll" "/noshadow" "/html" "/Users/sgr/Documents/laboratory/hello-fsharp/build/app/doc/Hello-FSharp-tests.dll.html" 
xUnit.net console test runner (32-bit .NET 4.0.30319.17020)
Copyright (C) 2013 Outercurve Foundation.

error: missing filename for /html
Running build failed.
Error:
System.Exception: xUnit failed for the following assemblies: ./build/test/Hello-FSharp-tests.dll
  at Fake.XUnitHelper+xUnit@124-1.Invoke (System.String message) [0x00000] in <filename unknown>:0 
  at Fake.XUnitHelper.xUnit (Microsoft.FSharp.Core.FSharpFunc`2 setParams, IEnumerable`1 assemblies) [0x00000] in <filename unknown>:0 
  at FSI_0001.Build+clo@193-13.Invoke (Microsoft.FSharp.Core.Unit _arg9) [0x00000] in <filename unknown>:0 
  at Fake.TargetHelper+targetFromTemplate@145[Microsoft.FSharp.Core.Unit].Invoke (Microsoft.FSharp.Core.Unit unitVar0) [0x00000] in <filename unknown>:0 
  at Fake.TargetHelper.runTarget@317 (System.String targetName) [0x00000] in <filename unknown>:0 

@neoeinstein
Copy link
Contributor

The issue here is actually not with FAKE, but with the xunit runner. It parses its command line arguments in a non-*nix friendly manner. If the path for the output file begins with a "/", then xunit is going to interpret it as another argument, not as the value for the /html, /xml, /nunit. The simplest way to attempt to work around this is to do a string replace on the current working directory, if present in the output dir. I'll submit a pull request to this effect. I'm also looking at re-implementing the xunit tasks so that they conform to the mechanisms of the nunit and mspec tasks.

neoeinstein added a commit to neoeinstein/FAKE that referenced this issue May 15, 2015
A rooted *nix path (beginning with /) is interpreted by the
xUnit runner as a command line directive. This causes the xUnit
runner to fail when report directories are specified when
building on Mono.

Fixes fsprojects#568
neoeinstein added a commit to neoeinstein/FAKE that referenced this issue May 15, 2015
A rooted *nix path (beginning with /) is interpreted by the
xUnit runner as a command line directive. This causes the xUnit
runner to fail when report directories are specified when
building on Mono.

Fixes fsprojects#568
@forki forki closed this as completed in 0ece10c May 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants