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

Integrating with .Net Core test project #77

Closed
zubr7 opened this issue Mar 10, 2020 · 2 comments
Closed

Integrating with .Net Core test project #77

zubr7 opened this issue Mar 10, 2020 · 2 comments

Comments

@zubr7
Copy link

zubr7 commented Mar 10, 2020

Describe the bug
First of all I'd like to say thank you for your project!
Unfortunately, I failed to integrate GHPReporter into my project (.Net Core Nunit test project). I didn't receive a generated file.

To Reproduce
Steps to reproduce the behavior:

  1. Added the entry below into 'C:\Users\windows_username.nuget\packages\nunit.consolerunner\3.11.1\tools\nunit.console.nuget.addins':
    'addins/../../../Users/windows_username/.nuget/packages/ghpr.nunit/0.9.10/lib/netstandard2.0/Ghpr.NUnit.dll'
  2. Copied 'Ghpr.NUnit.Settings.json' file from 'C:\Users\windows_username.nuget\packages\ghpr.nunit\0.9.10\content' to the root of my project
  3. Checked that 'bin\Debug\netcoreapp3.1' folder contains Ghpr.Core.dll, Ghpr.NUnit.dll, Ghpr.LocalFileSystem.dll, Ghpr.NUnit.Settings.json and Newtonsoft.Json.dll
  4. Run my tests by cmd: 'dotnet test -l trx -r report'

Expected behavior
A HTML report should be generated. I checked the root of C drive, project root folder, 'bin', 'obj' folders.

Screenshots
image
image

Versions
.Net Core 3.1
GHPReporter 0.9.10,
Nunit 3.12.0,
Nunit.ColsoleRunner 3.11.1,

@elv1s42 elv1s42 self-assigned this Mar 17, 2020
@elv1s42
Copy link
Member

elv1s42 commented Mar 17, 2020

Hi @zubr7 ,
Thank you for the issue and sorry for the late response.
The issue we are having here is that NUnit works a little bit different when running .NET Core tests, see the corresponding issue here: nunit/nunit-console#487

So I had to create a new issue here: #57
The idea is that we need a new NuGet package which will be detected automatically by NUnit when running .NET Core tests.

For now, I think it may be possible to use Ghpr.Console package to generate the report from the .xml file with test results.

Thank you

@elv1s42
Copy link
Member

elv1s42 commented Mar 18, 2020

Hi @zubr7,

Now you should be able to use Ghpr.NUnit inside your .NET Core test projects.

The solution was to add a new .addins file which is detected by NUnit3TestAdapter.

So here is a short instruction on how to quickly set up a .NET Core NUnit test project with Ghpr.NUnit (I'm using VS19):

  1. Create a new test project from template:
    image

  2. Install other required NuGet packages, so the full list will be as follows:

    <PackageReference Include="Ghpr.NUnit" Version="0.9.11" />
    <PackageReference Include="nunit" Version="3.12.0" />
    <PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
    <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
    <PackageReference Include="Ghpr.Core" Version="0.9.10" />
    <PackageReference Include="Ghpr.LocalFileSystem" Version="0.9.10" />
  1. Make sure to include Ghpr.NUnit.Settings.json and Ghpr.NUnit.addins files into your project (and mark them with Copy always attribute). You can find both files in the corresponding NuGet folder of the Ghpr.NUnit package (starting from v0.9.11):
    image

  2. Run your tests using dotnet test command:
    image

  3. See the report generated:
    image

Please feel free to reopen this issue or raise a new one in case there is something wrong with how the package works for .NET Core tests.

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants