Skip to content

lanzelot1989/Ghpr.NUnit

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Project icon

Some Links:
Core | MSTest | NUnit | SpecFlow | Console | Site Repo

Language Build status NuGet Version

Ghpr.NUnit

Usage:

Please use this project with targetFramework v4.5.2

  • Install NUnit 3 console latest release
  • Download the latest version of Ghpr.NUnit (using NuGet)
  • Put Ghpr.Core.dll, Ghpr.NUnit.dll, Ghpr.NUnit.Settings.json and Newtonsoft.Json.dll to the following folder: [nunit_console_location]/nunit-console/addins
  • Add path addins/Ghpr.NUnit.dll into nunit.engine.addins file
  • Run your tests via NUnit Console

NOTE: If you are going to take screenshots inside yout tests, then make sure that you have the same Ghpr.NUnit.Settings.json file inside your C# project and inside NUnit.Console addins folder.

How to publish the report in Jenkins

Please, read this 'How to publish the report in Jenkins' instruction.

How to work with screenshots

If you want to add screenshots to your report, you need to implement your own method of taking screenshot as byte[]. This is needed because there is no way to take screenshot which will work on any testing framework or CI tool (such as Jenkins or TeamCity). If you are using WebDriver, you can take screenshot using WebDriver.

[Test]
public void TestMethod()
{
    var bytes = TakeScreenshot(); //your implementation
    //all you need to do is to pass byte[] to ScreenHelper:
    ScreenHelper.SaveScreenshot(bytes);
}

If you want to be able to take screenshots for failed tests, you can take a look at this approach:

[TearDown]
public void TakeScreenIfFailed()
{
    var res = TestContext.CurrentContext.Result.Outcome;
    if (res.Equals(ResultState.Failure) || res.Equals(ResultState.Error))
    {
        ScreenHelper.SaveScreenshot(TakeScreenshot());
    }
}

Demo Report

You can view Demo report on our site

View report locally

Please read Core instructions or this comment about opening report in Chrome

Contributing

Anyone contributing is welcome. Write issues, create pull requests.

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 100.0%