xUnit 2.0 support

ycrumeyrolle's Avatar

ycrumeyrolle

14 Aug, 2014 01:30 PM

xUnit 2.0 does not seems to be supported.
The test discovery always returns zero test.

In xUnit 2.0, xunit.dll does not exist anymore. You should check for xunit.core.dll instead.

Showing page 2 out of 2. View the first page

  1. Support Staff 31 Posted by Feodor Fitsner on 26 Mar, 2015 10:05 AM

    Feodor Fitsner's Avatar

    Add nuget restore to "Before build script". Worked like a charm: https://ci.appveyor.com/project/FeodorFitsner/toxiproxy-net

    Consider getting rid of .nuget folder and using nuget restore for restoring packages.

  2. 32 Posted by Mark on 26 Mar, 2015 11:05 AM

    Mark's Avatar

    Cool - works like a charm.
    I will need to loo at Automatic Package Restore as well.
    Thanks again.

  3. 33 Posted by richard.bogle on 09 Apr, 2015 05:15 PM

    richard.bogle's Avatar

    What is the minimum that is required to get the xUnit v.2 tests working?

    This a default build script with no appveyor.yml file. It mentions %xunit20%\xunit.console.x86 so it's recognised xUnit v.2. Nuget restore is working and then launching Paket which is also working.

    Discovering tests...OK
    %xunit20%\xunit.console.x86 "C:\projects\featureflagger\FeatureFlagger.Tests\bin\Debug\FeatureFlagger.Tests.dll" -appveyor
    xUnit.net console test runner (32-bit .NET 4.0.30319.34209)
    Copyright (C) 2015 Outercurve Foundation.
     
    Discovering: FeatureFlagger.Tests
    System.ArgumentException: Unknown test framework: Could not find xunit.dll or xunit.execution.desktop.dll.
    Parameter name: C:\projects\featureflagger\FeatureFlagger.Tests\bin\Debug\FeatureFlagger.Tests.dll
    Command exited with code 1
    
  4. Support Staff 34 Posted by Feodor Fitsner on 09 Apr, 2015 05:26 PM

    Feodor Fitsner's Avatar

    Have you tried doing nuget restore in "Before build script"? There is a custom .targets file in xunit 2.0 that copies xunit.execution.desktop.dll to build output folder (see this import in a test xunit 2.0 project). Looks like this file should exist before build starts.

  5. 35 Posted by richard.bogle on 09 Apr, 2015 07:17 PM

    richard.bogle's Avatar

    The nuget restore is in the Build tab's "Before build script" by default (I think). It may be that Paket isn't doing exactly the same thing. I'll have to check by switching back to nuget for package management as a trial. The complete build result, however, implies that Paket is getting it right.

    Build started
    git clone -q --branch=master git://github.com/Boggin/FeatureFlagger.git C:\projects\featureflagger
    git checkout -qf c3e856fa9336dab1fa169d8c3b85a1a6cb260339
    nuget restore
    Installing 'Paket 0.35.8'.
    Successfully installed 'Paket 0.35.8'.
    "C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe" "FeatureFlagger.sln" /verbosity:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
    Microsoft (R) Build Engine version 12.0.31101.0
    [Microsoft .NET Framework, version 4.0.30319.34209]
    Copyright (C) Microsoft Corporation. All rights reserved.
     
      Paket version 0.35.8.0
      Downloading Microsoft.Composition 1.0.30 to C:\Users\appveyor\AppData\Local\NuGet\Cache\Microsoft.Composition.1.0.30.nupkg
      Microsoft.Composition 1.0.30 unzipped to C:\projects\featureflagger\packages\Microsoft.Composition
      6 seconds - ready.
      Paket version 0.35.8.0
      2 seconds - ready.
      FeatureFlagger.Behaviours -> C:\projects\featureflagger\FeatureFlagger.Behaviours\bin\Debug\FeatureFlagger.Behaviours.dll
      Paket version 0.35.8.0
      2 seconds - ready.
      FeatureFlagger.Domain -> C:\projects\featureflagger\FeatureFlagger.Domain\bin\Debug\FeatureFlagger.Domain.dll
      FeatureFlagger.ConfigurationReaders -> C:\projects\featureflagger\FeatureFlagger.ConfigurationReaders\bin\Debug\FeatureFlagger.ConfigurationReaders.dll
    CSC : warning CS1607: Assembly generation -- The version '0.0.1-alpha003' specified for the 'file version' is not in the normal 'major.minor.build.revision' format [C:\projects\featureflagger\FeatureFlagger\FeatureFlagger.csproj]
      FeatureFlagger -> C:\projects\featureflagger\FeatureFlagger\bin\Debug\FeatureFlagger.dll
      Paket version 0.35.8.0
      Downloading xunit.core 2.0.0 to C:\Users\appveyor\AppData\Local\NuGet\Cache\xunit.core.2.0.0.nupkg
      Downloading Should 1.1.20 to C:\Users\appveyor\AppData\Local\NuGet\Cache\Should.1.1.20.nupkg
      Downloading xunit.abstractions 2.0.0 to C:\Users\appveyor\AppData\Local\NuGet\Cache\xunit.abstractions.2.0.0.nupkg
      Downloading NSubstitute 1.8.1.0 to C:\Users\appveyor\AppData\Local\NuGet\Cache\NSubstitute.1.8.1.nupkg
      Downloading xunit 2.0.0 to C:\Users\appveyor\AppData\Local\NuGet\Cache\xunit.2.0.0.nupkg
      Downloading xunit.assert 2.0.0 to C:\Users\appveyor\AppData\Local\NuGet\Cache\xunit.assert.2.0.0.nupkg
      Downloading xunit.extensibility.core 2.0.0 to C:\Users\appveyor\AppData\Local\NuGet\Cache\xunit.extensibility.core.2.0.0.nupkg
      xunit.abstractions 2.0.0 unzipped to C:\projects\featureflagger\packages\xunit.abstractions
      Should 1.1.20 unzipped to C:\projects\featureflagger\packages\Should
      xunit 2.0.0 unzipped to C:\projects\featureflagger\packages\xunit
      NSubstitute 1.8.1.0 unzipped to C:\projects\featureflagger\packages\NSubstitute
      xunit.assert 2.0.0 unzipped to C:\projects\featureflagger\packages\xunit.assert
      xunit.extensibility.core 2.0.0 unzipped to C:\projects\featureflagger\packages\xunit.extensibility.core
      xunit.core 2.0.0 unzipped to C:\projects\featureflagger\packages\xunit.core
      7 seconds - ready.
      FeatureFlagger.Tests -> C:\projects\featureflagger\FeatureFlagger.Tests\bin\Debug\FeatureFlagger.Tests.dll
      FeatureFlagger.Example.Console -> C:\projects\featureflagger\FeatureFlagger.Example.Console\bin\Debug\FeatureFlagger.Example.Console.exe
    Discovering tests...OK
    %xunit20%\xunit.console.x86 "C:\projects\featureflagger\FeatureFlagger.Tests\bin\Debug\FeatureFlagger.Tests.dll" -appveyor
    xUnit.net console test runner (32-bit .NET 4.0.30319.34209)
    Copyright (C) 2015 Outercurve Foundation.
     
    Discovering: FeatureFlagger.Tests
    System.ArgumentException: Unknown test framework: Could not find xunit.dll or xunit.execution.desktop.dll.
    Parameter name: C:\projects\featureflagger\FeatureFlagger.Tests\bin\Debug\FeatureFlagger.Tests.dll
    Command exited with code 1
    
  6. Support Staff 36 Posted by Feodor Fitsner on 09 Apr, 2015 07:24 PM

    Feodor Fitsner's Avatar

    OK, nuget restore downloaded paket, but now paket runs as part of the build, so when msbuild build starts and csproj is read that xunit targets file does not exist yet voiding its import. Is there a way to run paket and restore *all* packages before msbuild starts?

    - Feodor

  7. 37 Posted by richard.bogle on 16 Apr, 2015 09:26 PM

    richard.bogle's Avatar

    I tried to put "paket install" after the "nuget restore" in "Before build script" which will restore all the packages before the build as you suggest, Feodor but as paket isn't installed on the build server this fails:

    Build started
    git clone -q --branch=master git://github.com/Boggin/FeatureFlagger.git C:\projects\featureflagger
    git checkout -qf c3e856fa9336dab1fa169d8c3b85a1a6cb260339
    nuget restore
    Installing 'Paket 0.35.8'.
    Successfully installed 'Paket 0.35.8'.
    paket install
    'paket' is not recognized as an internal or external command,
    operable program or batch file.
    Command exited with code 1
    

    So I somehow need a reference to the newly installed paket.exe that I can call or paket needs to be on the build server or I need to move away from the settings that are available through the UI and try to create a better build script to run.

    Any suggestions welcomed.

  8. Support Staff 38 Posted by Feodor Fitsner on 16 Apr, 2015 11:18 PM

    Feodor Fitsner's Avatar

    I think you should call it as:

    packages\Paket.0.35.8\tools\paket install
    
  9. 39 Posted by Andrey Shchekin on 21 Apr, 2015 04:35 AM

    Andrey Shchekin's Avatar

    I get something even weirder:

    Discovering tests...OK
    %xunit20%\xunit.console.x86 "C:\projects\impostor#packages\xunit.core.2.0.0\build\monoandroid\xunit.execution.MonoAndroid.dll" -appveyor
    xUnit.net console test runner (32-bit .NET 4.0.30319.34209)
    Copyright (C) 2015 Outercurve Foundation.


    Discovering: xunit.execution.MonoAndroid System.ArgumentException: Unknown test framework: Could not find xunit.dll or xunit.execution.desktop.dll. Parameter name: C:\projects\impostor#packages\xunit.core.2.0.0\build\monoandroid\xunit.execution.MonoAndroid.dll Command exited with code 1

    Even though my project has nothing to do with MonoAndroid.

  10. 40 Posted by Andrey Shchekin on 21 Apr, 2015 04:37 AM

    Andrey Shchekin's Avatar

    I have a custom nuget.config that puts packages into #packages.

  11. Support Staff 41 Posted by Feodor Fitsner on 21 Apr, 2015 04:41 AM

    Feodor Fitsner's Avatar

    It's just xunit.execution.MonoAndroid is not added to the ignored list of auto-discovered assemblies. Either add xunit.execution.MonoAndroid.dll to exclude assemblies list or use your own test script command to call xunit runner with correct assembly.

    I'll add an issue to fix that by the next release.

  12. 42 Posted by Andrey Shchekin on 21 Apr, 2015 05:26 AM

    Andrey Shchekin's Avatar

    That solved it, thanks!

  13. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 01:55 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

 

21 Mar, 2019 05:38 PM
21 Mar, 2019 06:16 AM
21 Mar, 2019 01:47 AM
20 Mar, 2019 11:39 PM
20 Mar, 2019 09:03 PM
20 Mar, 2019 08:55 PM