Coder Social home page Coder Social logo

ghpreporter / ghpr.nunit Goto Github PK

View Code? Open in Web Editor NEW
35.0 4.0 14.0 3.19 MB

Adapter for NUnit 3 (generate HTML report for NUnit 3)

Home Page: http://ghpreporter.github.io/

License: MIT License

C# 100.00%
nunit-console screenshot nuget test-automation addin reporting nunit report html quality-assurance

ghpr.nunit's People

Contributors

dependabot-preview[bot] avatar dependabot-support avatar elv1s42 avatar fossabot avatar mend-bolt-for-github[bot] avatar yfrindel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ghpr.nunit's Issues

NUnit Test Attachments aren't working as Screenshots

Describe the bug
I am trying to add screenshots to the GHP report by using Nunit Test Attachments. The attachment is in the test result xml file, but it is not showing up in the html report.

Here is the screenshot code. This occurs in [TearDown]:

            var screenshot = ((ITakesScreenshot)Driver.Get()).GetScreenshot();
            string fileName = CurrentTestNameToJPG();
            screenshot.SaveAsFile(fileName);
            TestContext.AddTestAttachment(fileName, "Failure Screenshot");

And here is the attachment in the xml file:

<attachments> <attachment> <filePath>C:\Screenshots\TQAA1271_SuccessfulStudentLogin_20190506_16-47-15.jpeg</filePath> <description> <![CDATA[Failure Screenshot]]> </description> </attachment> </attachments>

Expected behavior
The screenshot should show up in the GHP report under "Screenshots"
Screenshotsghpr

GHPR Version - 0.8.0.2
NUnit 3 Console - 3.7

NUnit Data Driven Results display incorrectly

Using the new NUnit TextFixtureSource attribute AND feeding in complex objects as structured data-driven test input, the results as displayed in GHPReporter on the run-test-list page.

Instead of displaying the real test namespace hierarchy, GHPReporter is using the namespace of the input objects as well.

capture

Data not showing in the report

Hi,

Files are generated when I ran the Nunit console application but when i open the index file and navigating further not showing any data. it is just showing empty values

Please help me on this.

Regards,
Nagarjuna

Support .NET 4.6.2

Hi ,

We are using the framework 4.6.2 and looking for instructions on how we can use the tool through command line

version:NUnit.ConsoleRunner.3.7.0

Regards
RP

No tests in the json files : All zeros

Hello,
I followed the steps from the github tutorial, but everytime i run my tests (2 selenium tests, nunit, c#) via the console runner, the generated json files are created with 0 results.

{"testRunFiles":[],"runInfo":{"guid":"2a45c56d-7034-4004-b110-415ec14891a3","start":"2017-10-09T13:29:37.3339941+02:00","finish":"2017-10-09T13:30:26.2869285+02:00","fileName":"run_2a45c56d-7034-4004-b110-415ec14891a3.json"},"sprint":"","name":"","summary":{"total":0,"success":0,"errors":0,"failures":0,"inconclusive":0,"ignored":0,"unknown":0}}

Regards,
Kais

Unable to generate the Ghpr report

Hi,

I have tried to implement Ghpr report and followed all the steps as mentioned in readme file....however I am not able to generate a report. Below are the steps which I have followed
-> I couldn't find any folder with name addins, so i have created a new folder under ".nuget\packages\nunit.consolerunner\3.8.0\addins" and added all required dlls into it.
-> There is no "nunit.engine.addins" file available, so manually created a file under ".nuget\packages\nunit.consolerunner\3.8.0\tools" and added the path as "../../addins/Ghpr.NUnit.dll"

Please find the dll's versions I have used:
Nunit : 3.9.0
Newtonsoft.Json : 10.0.3
NUnit Console : 3.8.0
Ghpr.NUnit : 0.8.0.2

Could you please help me on resolving this issue

Regards,
Sathish Kumar Mani

usage issue

I downloaded the https://github.com/GHPReporter/Ghpr.NUnit.Examples

1 When I use NuGet to download the Ghpr.Console and compile the Ghpr.NUnit.Examples. It will display error that "Console.WriteLine()" can't parsed in .cs files. I need to use System.Console.Write() in .cs files to pass the build.
So could someone update the Ghpr.Console plug-in to mitigate the build error?

  1. For the usage
    "Add relative path to Ghpr.NUnit.dll from build folder of your tests (example: addins/../../../Users/Evgeniy_Kosjakov/Documents/GitHub/Ghpr.NUnit.Examples/build/Ghpr.NUnit.dll) into nunit.bundle.addins"

In fact, there is no nunit.bundle.addins files in the package of NUnit.ConsoleRunner.3.10.0. It only has nunit.nuget.addins in tools directory of NUnit.ConsoleRunner.3.10.0.
I added below content in

../../../../build/Ghpr.NUnit.dll

So could someone update the instruction?

After I modify the Ghpr.NUnit.Settings.json to latest version and copy it to the generated build directory of Ghpr.NUnit.Examples.
Then I use nunit3-console to generate .xml file and use ghph.console to generate html format file successfully.

Blank report is generated with NUnit.ConsoleRunner.3.11.1

Hi, I have a problem with report generation. I run my tests with ConsoleRunner (or Console - the same result) and after the tests finished, the folder with a report is generated but looks empty
image
image

The strange thing is the screenshot, as well as TestResult.xml file, is placed in the working directory, not in the report folder.
Here is my Ghpr.NUnit.Settings.json (default values):
image
Build folder
image

report folder:
_GHPReporter_Core_Report.zip
my ConsoleRunner:
NUnit.ConsoleRunner.3.11.1.zip

Screenshot is added by this method: TestContext.AddTestAttachment(screenShotPath);
Thak you for help in advance.

Dependabot couldn't find a Ghpr.Core.csproj for this project

Dependabot couldn't find a Ghpr.Core.csproj for this project.

Dependabot requires a Ghpr.Core.csproj to evaluate your project's current Dotnet dependencies. It had expected to find one at the path: /Ghpr.Core/Ghpr.Core/Ghpr.Core.csproj.

If this isn't a Dotnet project, or if it is a library, you may wish to disable updates for it from within Dependabot.

You can mention @dependabot in the comments below to contact the Dependabot team.

Release preparation

Prepare the release by updating .nuspec file and adding support for .NET Core 3.0

Support Attachment Nodes for Screenshot Mapping

With recent releases of NUnit, AddTestAttachment(string filePath, string description = null); allows screenshots to now be mapped to the test case: https://github.com/nunit/docs/wiki/TestContext.

<test-case>
  <output>...</output>
  <attachments>
    <attachment description="This is a description of this screenshot.">
      <filePath></filePath>
    </attachment>
    <attachment description="This is a description of this screenshot.">
      <filePath></filePath>
    </attachment>
  </attachments>
</test-case>

This would reduce the need for ScreenHelper.

Blank report is generated

I have installed Nunit Console Runner 3.6.0 and set up with libraries as described:
Then run my TestProject_Ghpr.dll containing a test.

Console output window:

c:\Program Files (x86)\NUnit.org\nunit-console>nunit3-console.exe "c:\Users\MartinCo.MGSOPS\Documents\Visual Studio 2015\Projects\TestProject_Ghpr\TestProject_Ghpr\bin\Debug\TestProject_Ghpr.dll"
NUnit Console Runner 3.6.0
Copyright (C) 2017 Charlie Poole

Runtime Environment
OS Version: Microsoft Windows NT 10.0.10586.0
CLR Version: 4.0.30319.42000

Test Files
c:\Users\MartinCo.MGSOPS\Documents\Visual Studio 2015\Projects\TestProject_Ghpr\TestProject_Ghpr\bin\Debug\TestProject_Ghpr.dll

=> TestProject_Ghpr.Class1.Test1
Inside test

Run Settings
DisposeRunners: True
WorkDirectory: c:\Program Files (x86)\NUnit.org\nunit-console
ImageRuntimeVersion: 4.0.30319
ImageTargetFrameworkName: .NETFramework,Version=v4.5.2
ImageRequiresX86: False
ImageRequiresDefaultAppDomainAssemblyResolver: False
NumberOfTestWorkers: 4

Test Run Summary
Overall result: Passed
Test Count: 1, Passed: 1, Failed: 0, Warnings: 0, Inconclusive: 0, Skipped: 0
Start time: 2017-02-21 13:37:58Z
End time: 2017-02-21 13:38:00Z
Duration: 2.398 seconds

Results (nunit3) saved as TestResult.xml

Report is created at the location from Ghpr.NUnit.Settings.json (c:_GHPReporter_NUnit_Report\index.html) but when you open the report it is blank. Am I missing something?

I am attaching report in zip file.
https://1drv.ms/u/s!AldGQH625sV0mQp2tsSaHkVDj1zi

image

Dependabot couldn't find a Ghpr.Core.csproj for this project

Dependabot couldn't find a Ghpr.Core.csproj for this project.

Dependabot requires a Ghpr.Core.csproj to evaluate your project's current Dotnet dependencies. It had expected to find one at the path: /Ghpr.Core/Ghpr.Core/Ghpr.Core.csproj.

If this isn't a Dotnet project, or if it is a library, you may wish to disable updates for it from within Dependabot.

You can mention @dependabot in the comments below to contact the Dependabot team.

Update nunit.framework reference in Ghpr.NUnit to NUnit version 3.9.0

Hi!

We updated our NUnit version today from 3.7.1 to version 3.9.0 which was released two days ago.
https://github.com/nunit/nunit/releases/tag/3.9

Unfortunately we have now troubles getting Screenshots for our GHPReports.

This is the error message we get:
System.IO.FileLoadException: Could not load file or assembly 'nunit.framework, Version=3.7.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) File name: 'nunit.framework, Version=3.7.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb' at Ghpr.NUnit.Utils.ScreenHelper.SaveScreenshot(Byte[] screenBytes)

We figured out, that there is still a reference to NUnit 3.7.1.

ghpr_nunit

Would you mind updating it to the latest version and plan a release for GHPReporter?

NullReferenceException on SaveScreenshot()

Hello,

Please review the exception we have, here is the stacktrace:

...
TearDown : System.TypeInitializationException : The type initializer for 'Ghpr.NUnit.Extensions.GhprEventListener' threw an exception.
----> System.NullReferenceException : Object reference not set to an instance of an object.
--TearDown
at Ghpr.NUnit.Extensions.GhprEventListener.get_OutputPath()
at Ghpr.NUnit.Utils.ScreenHelper.SaveScreenshot(Byte[] screenBytes)
...

Setup is Specflow + Selenium. Exception does not appear on all dev's computers. Running version 0.5.0.2 of both Core&NUnit.

If more information is needed please request so I can deliver.

Regards,

Ghpr.NUnit/Ghpr.Console does not work with NUnit.Engine3.9.0

Hi,

There's is a new version of NUnit.Engine (3.9.0) and I have found out that report does not get generated with this version. Workaround is to roll back NUnit.Engine to 3.8.0.

Environment:
Ghpr.Console {0.9.2}
Ghpr.Core {0.9.2}
Ghpr.LocalFileSystem {0.9.2}
Ghpr.MSTest {0.9.2.1}
Ghpr.NUnit {0.9.2}
Newtonsoft.Json {11.0.2}
NUnit {3.10.1}
NUnit.Console {3.9.0}
NUnit.ConsoleRunner {3.9.0}
NUnit.Engine {3.8.0}

Steps To Reproduce:

  1. Run Test via nunit console runner
  2. Run Ghpr console against the generated xml test result file

Result:
Folder defined in Ghpr.NUnit.Settings.json does not get created and report is not generated

'nunit.engine.addins' file and location changed. Need to update Readme file

Describe the bug
In the latest Nunit Console install package, the file 'nunit.engine.addins' has changed it's name and path.
Which means, https://github.com/GHPReporter/Ghpr.NUnit this readme doc is out dated.
It confused me a while before I realized what wrong was it.

Old Name: nunit.engine.addins
Old Path: \YOURLOCATION\NUnit.org\nunit-console\addins
New Name: nunit.bundle.addins
New Path: \YOURLOCATION\NUnit.org\nunit-console

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://github.com/nunit/nunit-console/releases
  2. Download and install NUnit.Console-3.9.0.msi
  3. Go to installed folder C:\Program Files (x86)\NUnit.org\nunit-console
  4. As you can see in the screenshot, there is no such file as 'nunit.engine.addins' in \addins folder anymore. Instead, a new file 'nunit.bundle.addins' has been added to the root nunit-console folder.

Expected behavior
In the Nunit readme file: https://github.com/GHPReporter/Ghpr.NUnit, we should change these places accordingly:
image

Screenshots
image
image

Desktop (please complete the following information):

  • OS: [Windows 10, 64bit]

Additional context
I have tried, modify the new nunit.bundle.addins file will generate the result report.

Setting run name on the fly

I've got some NUnit tests that run multiple times with different parameters and I need a way to distinguish the runs in the HTML reporter, like:

[Role] - [Facility] - [Date] instead of the default
[StartTime] - [EndTime]

The only thing I've been able to do so far is to read the Ghpr.NUnit.Settings.json file and write the runName I want into the file (not desirable).

Add Output from OneTimeSetup and OneTimeTearDown Methods

While I find the logs from each test-case output node useful within the report, it would be even more useful to include the test-suite output as well. The test-suite output can potentially be added to the Output tab for each test or to a new Output tab when clicking on what is now the collapsible links in the test list. The first approach needs to keep in mind that suites can be nested as found below, and will need to contain only the test-suite output for the suite(s) they are a part of. The second approach allows for a hierarchical view of what was executed where (minus the OneTimeTearDown as its output is lumped in with the output from OneTimeSetUp).

What is currently found:

<test-case ...>
...
<output><![CDATA[2018-06-06 13:27:50.419		T12		Start Test - TestRunId: , TestCaseId: , NUnitName: 'TestScripts.ServicePortalTests.TestDownloadToAllDevicesInCampus'
2018-06-06 13:27:55.532		T12		Event Navigated to xxxxx:55555/
Additional detail: Current URL is http://xxxxx:55555/login
2018-06-06 13:27:55.547		T12		Info Logging into ServicePortal
Additional detail: user: 'xxxxx', password: 'xxxxx', expectEror: False
2018-06-06 13:28:08.101		T12		Exceptions logged during test 1-1018:
   at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
   ...
2018-06-06 13:28:08.101		T12		
********************************************************************************
End Test - Status: 'Failed', TestRunId: , TestCaseId: , NUnitName: 'TestScripts.ServicePortalTests.TestDownloadToAllDevicesInCampus'
1 tests run; 0 passed; 1 failed; 0 skipped
********************************************************************************
]]></output>
</test-case>

What I'd like to see added:

<test-suite ...>
...
<output><![CDATA[2018-06-06 13:27:45.736		T9		Start Run; NUnit parameters: { 'e': 'xxxxx', 'r': 'false', 'c': 'false', 'l': 'Info', 'o': 'C:\Program Files (x86)\Jenkins\workspace\Test\test-output' }.
2018-06-06 13:28:08.191		T9		End Run; passed: 0, failed: 1, skipped: 2.
]]></output>
...
<test-suite ...>
...
<output><![CDATA[2018-06-06 13:27:45.778		T12		Start Suite - ServicePortalTests.
2018-06-06 13:27:45.802		T12		Info Fixture 'TestScripts.ServicePortalTests' will run in environment 'xxxxx'.
2018-06-06 13:28:08.185		T11		End Suite - ServicePortalTests; passed: 0, failed: 1, skipped: 2.
]]></output>
...
</test-suite>
</test-suite>

Please see TestResult.zip for a small example of the XML generated from an NUnit run.

Report displays no data about specific runs

It appears that my test results are not being properly written to the reporting tool. When viewing the report, I see the number of runs, and dates for those runs, but upon drilling into the individual runs, the main statistics and test list show that no tests were run.

Attached is my TestResults.xml files and the report generated from this run. The report uses the example data provided. TestResult.zip

Do you have any suggestions as to what I may have missed during the initial installation? Any help would be appreciated.

Screenshot added via NUnit TestContext.AddTestAttachment does not display GHPReport

Screenshot is not displaying in the GHPReport

From a Selenium Test, I'm adding creating a screen shot and adding it to the NUNIT log:
TestContext.AddTestAttachment("C:\temp\emailName.JPG");

Generated XML looks something like:
image

To generate the GHPReport, I'm including NuGet packages:
image

I'm expecting to see the .jpg in the Screenshots link, but it does not display:

image

The test_20191023_191447000.json look like:
{
"name": "ParallelTest_A_00",
"fullName": "AutomationTests.ParallelTests.ParallelTest_A.ParallelTest_A_00",
"description": null,
"duration": 0.262805,
"testStackTrace": " at AutomationTests.Base.BaseTest.ExecuteTest(Action action, DriverType driverType, String strTestName) in C:\TFS\QAAutomation\AutomationTests\Base\BaseTest.cs:line 71\r\n at AutomationTests.ParallelTests.ParallelTest_A.ParallelTest_A_00() in C:\TFS\QAAutomation\AutomationTests\ParallelTest_A.cs:line 106",
"testMessage": "System.Exception : Retries Exceeded. Exception: NUnit.Framework.AssertionException: Expected: True\r\n But was: False\r\n\r\n at NUnit.Framework.Assert.ReportFailure(String message) in D:\a\1\s\src\NUnitFramework\framework\Assert.cs:line 394\r\n at NUnit.Framework.Assert.That[TActual](TActual actual, IResolveConstraint expression, String message, Object[] args) in D:\a\1\s\src\NUnitFramework\framework\Assert.That.cs:line 241\r\n at AutomationTests.ParallelTests.ParallelTest_A.<>c.<ParallelTest_A_00>b__2_0() in C:\TFS\QAAutomation\AutomationTests\ParallelTest_A.cs:line 104\r\n at AutomationTests.Base.BaseTest.ExecuteTest(Action action, DriverType driverType, String strTestName) in C:\TFS\QAAutomation\AutomationTests\Base\BaseTest.cs:line 46 1) Expected: True\r\n But was: False\r\n\r\n",
"result": "Failed: Error",
"testType": null,
"output": {
"itemName": "test_output_20191023_191447000.json",
"date": "2019-10-23T19:14:47Z"
},
"priority": null,
"categories": [
"P22"
],
"testInfo": {
"guid": "493c9583-7c24-0582-5194-66ed161b96b3",
"start": "2019-10-23T19:14:46Z",
"finish": "2019-10-23T19:14:47Z",
"itemName": "test_20191023_191447000.json"
},
"runGuid": "651dc1f6-0ead-4436-b808-1998debd6979",
"screenshots": [],
"events": [],
"testData": [],
"FailedOrBroken": true,
"TestResult": 2
}

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser Chrome

Start datetime display doesn't match NUNIT start-time

Describe the bug
Looking at the NUNIT log, the tests ran from:
start-time="2019-10-07 02:51:57Z"
end-time="2019-10-07 07:10:49Z"
duration="15532.193087"

But the report is displaying:
Start datetime: 2019-10-06 22:51:58
Finish datetime: 2019-10-07 03:10:49
Duration: 04:18:51.00

Start datetime has the wrong day and time!

image

image

Expected behavior
Was expecting to see something along the lines of:
Start datetime: 2019-10-07 02:51:57
Finish datetime: 2019-10-07 07:10:49

The NuGet packages I'm using are the latest:

image

New version of Newtonsoft.Json

Hello,
There is new version of Newtonsoft.Json
When I put the new version .dll I got the following error:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeI
nitializationException: The type initializer for 'Ghpr.NUnit.Extensions.GhprEventListener' threw an exception. ---> Syst
em.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicK
eyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.
at Ghpr.Core.Helpers.ReporterHelper.GetSettingsFromFile(String fileName)
...

Please, if possible, update to the new version of Newtonsoft.Json

Newtonsoft.json v11 not supported

Hello,
There is new version of Newtonsoft.Json: v11
Upgrading to it causes the following error:
System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation. ----> System.TypeInitializationException : The type initializer for 'Ghpr.NUnit.Extensions.GhprEventListener' threw an exception. ----> System.IO.FileNotFoundException : Could not load file or assembly 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependenci es. The system cannot find the file specified.

It would be much appreciated if you cold update and add the support for new version.
Thanks in advance!

Integrating with .Net Core test project

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,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.