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

Does this support team city and net core? #29

Open
Dev123213 opened this issue Aug 30, 2017 · 5 comments
Open

Does this support team city and net core? #29

Dev123213 opened this issue Aug 30, 2017 · 5 comments

Comments

@Dev123213
Copy link

I have a class library:

  • Target Framework net core 2
  • Output type class library

Csproj:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <ApplicationIcon />
    <OutputType>Library</OutputType>
    <StartupObject />
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0-preview-20170810-02" />
    <PackageReference Include="xunit" Version="2.3.0-beta4-build3742" />
    <PackageReference Include="xunit.runner.console" Version="2.3.0-beta4-build3742" />
    <DotNetCliToolReference Include="dotnet-xunit" Version="2.3.0-beta4-build3742" />
  </ItemGroup>
</Project>

nugets:
Microsoft.NET.Test.Sdk, xunit, xunit.runner.console, microsoft.netcore.app

Team city build config:

  1. net core restore
  2. net core publish
    • output dir: %system.teamcity.build.checkoutDir%/Tests
    • framework: netcoreapp2.0
  3. xunit:
    • version 2.2.0
    • AnyCPU/MSIL
    • .NET 4.5 (only option it gives me)
    • assemblies containing tests: %system.teamcity.build.checkoutDir%/Tests/*.dll

All I get is:

[15:51:08]Step 6/6: xUnit
[15:51:08][Step 6/6] Runner parameters { Version = 2.2.0, runtime = .NET 4.5, platform = AnyCPU/MSIL}
[15:51:08][Step 6/6] Number of parallel processes is set to: 1
[15:51:08][Step 6/6] Starting test runner at C:\BuildAgent\tools\xunit-runner\bin\2.2.0\xunit.console.exe
[15:51:08][Step 6/6] No assemblies were matched - no tests will be run!

I am unable to get anywhere. I have tried changing nuget versions to 2.2.0 for all, as well as all the pre-releases, and different configurations inbetween.

@Dev123213
Copy link
Author

Dev123213 commented Aug 30, 2017

Further, I tried executing the exe manually and I get the following:

C:\>C:\BuildAgent\tools\xunit-runner\bin\2.2.0\xunit.console.exe C:/BuildAgent/work/68ab5b6fa6e51f21/Tests/XUnitCore.dll -teamcity
xUnit.net Console Runner (64-bit .NET 4.0.30319.42000)
System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

Adding this to my project didn't seem to fix anything (there isn't even a v4.2.0.0 so I did 4.3.0)

@Dev123213
Copy link
Author

I have finally found that TeamCity.VSTest.TestAdapter will give me a more detailed error:

Step 6/6: xUnit
[16:27:14][Step 6/6] Runner parameters { Version = 2.2.0, runtime = .NET 4.5, platform = AnyCPU/MSIL}
[16:27:14][Step 6/6] Failed to run tests
[16:27:14]
[Step 6/6] java.lang.NumberFormatException: For input string: ""
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
	at java.lang.Integer.parseInt(Integer.java:592)
	at java.lang.Integer.parseInt(Integer.java:615)
	at se.capeit.dev.xunittestrunner.XUnitBuildProcess.call(XUnitBuildProcess.java:58)
	at se.capeit.dev.xunittestrunner.XUnitBuildProcess.call(XUnitBuildProcess.java:19)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
[16:27:14][Step 6/6] Step xUnit failed

(note, 2 steps are disabled which is why you may noticed step 6/6) but I only mentioned 4 steps.

@carlpett
Copy link
Owner

Hi @Dev123213,
Sorry that it is not working for you. I think there are multiple problems here, so let's go through them.

In the first post, you get the error "No assemblies were matched - no tests will be run!". This is because you are specifying an absolute path, which as discovered in #27 is not supported yet. Until I've had time to fix that, I would recommend changing to a relative path, ie Tests/*.dll instead.

The third post makes me wonder what version of the plugin you are using? The error you are seeing in your last comment looks like one that occurred in a fork of the plugin. While that is still published on the Teamcity plugins page, it is by now quite old and has a few bugs.

But even fixing those two issues, I think your second post shows the error that will happen when the two other are resolved. The current (2.2) release of xUnit does not support .net core, as seen in the compatibility matrix. I'm not sure when 2.3 will hit a full release, but there will likely be a few other changes required to support the new runner.

@Dev123213
Copy link
Author

Hi Carl, thanks for getting back to me promptly. I have fixed the path, and am using the most recent plugin version advertised here (1.2) https://github.com/carlpett/xUnit-TeamCity/releases/tag/v1.2.0.

To clarify your last paragraph, xunit does support .net core (https://xunit.github.io/docs/getting-started-dotnet-core.html), but the plugin for team city does not? If so, I will have to abandon xunit for now as we want net core.

@carlpett
Copy link
Owner

Ok, that is good to know. I'll see if I can recreate it. The line numbers in the stack trace don't seem to match the code, though, which is confusing....

xUnit supports .net core in their beta releases, yes, but there is no supported version with a finalized way of running it yet (it has changed between different beta versions, as I understand it). So I'm a bit wary of integrating it before that has settled down.

One thing you could do as a workaround until this is supported would be to add a "Command line" build step and run dotnet xunit -teamcity there, which should turn on teamcity reporting mode so that it is properly picked up.

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

2 participants