LambdaFactory / Neptune-public

Repository for Neptune questions and issues
https://gumroad.com/l/NeptunePlugin
Other
26 stars 0 forks source link

Errors running xunit tests in full .NET framework project. #3

Closed priort closed 6 years ago

priort commented 6 years ago

Firstly thanks for this plugin and it works with no issues for me for .NET core. However I have problems with xunit on a full .NET project. I have pasted my fsproj file below so that you can see target version and the referenced packages that I installed with nuget.

Firstly, I get this error: ENOENT: no such file or directory, open 'c:\Users\prior\OneDrive\d\XunitPlayground\Tests\TestResult.xml'

And when I create that TestResult.xml file and run the test I get these errors Cannot read property '0' of undefined Running test failed - {}

The neptune log shows [10:21:01 DEBUG] error: missing filename for -nunit

Maybe I just need some other nuget dependency or runner?

Thanks

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="..\packages\xunit.runner.visualstudio.2.4.0-beta.1.build3958\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\packages\xunit.runner.visualstudio.2.4.0-beta.1.build3958\build\net20\xunit.runner.visualstudio.props')" />
  <Import Project="..\packages\xunit.runner.console.2.4.0-beta.1.build3958\build\xunit.runner.console.props" Condition="Exists('..\packages\xunit.runner.console.2.4.0-beta.1.build3958\build\xunit.runner.console.props')" />
  <Import Project="..\packages\xunit.core.2.4.0-beta.1.build3958\build\xunit.core.props" Condition="Exists('..\packages\xunit.core.2.4.0-beta.1.build3958\build\xunit.core.props')" />
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <Import Project="..\packages\FSharp.Compiler.Tools.10.0.1\build\FSharp.Compiler.Tools.props" Condition="Exists('..\packages\FSharp.Compiler.Tools.10.0.1\build\FSharp.Compiler.Tools.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{611E02BE-F22E-4091-8DAD-868D4C9B9EDB}</ProjectGuid>
    <OutputType>Library</OutputType>
    <RootNamespace>Tests2</RootNamespace>
    <AssemblyName>Tests2</AssemblyName>
    <TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <Tailcalls>false</Tailcalls>
    <OutputPath>bin\$(Configuration)\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <WarningLevel>3</WarningLevel>
    <OtherFlags>--warnon:1182</OtherFlags>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <Tailcalls>true</Tailcalls>
    <OutputPath>bin\$(Configuration)\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <WarningLevel>3</WarningLevel>
    <OtherFlags>--warnon:1182</OtherFlags>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="mscorlib" />
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Numerics" />
    <Reference Include="FSharp.Core">
      <HintPath>..\packages\FSharp.Core.4.3.4\lib\net45\FSharp.Core.dll</HintPath>
    </Reference>
    <Reference Include="System.ValueTuple">
      <HintPath>..\packages\System.ValueTuple.4.4.0\lib\netstandard1.0\System.ValueTuple.dll</HintPath>
    </Reference>
    <Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c">
      <HintPath>..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll</HintPath>
    </Reference>
    <Reference Include="xunit.assert, Version=2.4.0.3958, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c">
      <HintPath>..\packages\xunit.assert.2.4.0-beta.1.build3958\lib\netstandard1.1\xunit.assert.dll</HintPath>
    </Reference>
    <Reference Include="xunit.core, Version=2.4.0.3958, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c">
      <HintPath>..\packages\xunit.extensibility.core.2.4.0-beta.1.build3958\lib\netstandard1.1\xunit.core.dll</HintPath>
    </Reference>
    <Reference Include="xunit.execution.desktop, Version=2.4.0.3958, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c">
      <HintPath>..\packages\xunit.extensibility.execution.2.4.0-beta.1.build3958\lib\net452\xunit.execution.desktop.dll</HintPath>
    </Reference>
    <Reference Include="xunit.runner.reporters.net452, Version=2.4.0.3958, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c">
      <HintPath>..\packages\xunit.runner.reporters.2.4.0-beta.1.build3958\lib\net452\xunit.runner.reporters.net452.dll</HintPath>
    </Reference>
    <Reference Include="xunit.runner.utility.net452, Version=2.4.0.3958, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c">
      <HintPath>..\packages\xunit.runner.utility.2.4.0-beta.1.build3958\lib\net452\xunit.runner.utility.net452.dll</HintPath>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="AssemblyInfo.fs" />
    <Compile Include="Library.fs" />
    <None Include="packages.config" />
    <None Include="Script.fsx" />
  </ItemGroup>
  <Import Project="$(FSharpTargetsPath)" Condition="Exists('$(FSharpTargetsPath)')" />
  <Import Project="..\packages\xunit.core.2.4.0-beta.1.build3958\build\xunit.core.targets" Condition="Exists('..\packages\xunit.core.2.4.0-beta.1.build3958\build\xunit.core.targets')" />
</Project>
Krzysztof-Cieslak commented 6 years ago

It looks like it can't find XUnit Console runner. Can you check if xunit.console.exe is anywhere in the packages folder?

priort commented 6 years ago

xunit.console.exe is in 2 places. I have another project in the same solution though becuase I created a C# xunit project off a template so I could compare the dependencies to see if I needed a different runner. I was still getting the errors with running the F# project tests before that though so I don't think its anything to do with having a C# proj in the same solution. I've attached screenshots of the directory structure in the packages directory for the directories containing xunit.console.exe. xunit-console-runner-location1 xunit-runner-console-location2

Krzysztof-Cieslak commented 6 years ago

Can you try using latest stable version of XUnit (2.3.1) instead of prerelease version that’s referenced by F# project?

priort commented 6 years ago

I created a new solution with one class library and just xunit and xunit.runner.console nuget packages using 2.3.1. I pushed everything to a repo including the packages folder etc. if you want to have a look. https://github.com/priort/Testing

The .idea directory is there as I used Rider to install the nuget packages (we don't use Paket in work yet and work is where I use full .NET framework - I use .NET core for everything else).

priort commented 6 years ago

I still get the same errors.

Krzysztof-Cieslak commented 6 years ago

Update released - please check out 1.0.5

priort commented 6 years ago

Awesome! That works now, thanks so much.

Krzysztof-Cieslak commented 6 years ago

Just one thing - TestResult.xml file doesn't need to be created by you, and should be gitignored. It's a file where "old" console N/XUnit runners put the results.

priort commented 6 years ago

Cool, yeah when I delete it and run the tests, it gets created again. Thanks!