anshooarora / extentreports-csharp

Community version of Extent API for .NET has moved to https://github.com/extent-framework/
http://extentreports.com/
Other
47 stars 43 forks source link

AddScreenCaptureFromPath fails - .Net v3.1.0 community #107

Closed SergeyC4 closed 6 years ago

SergeyC4 commented 6 years ago

Moved from Klovrepo. Got Object reference not set to an instance of an object on Test.AddScreenCaptureFromPath(DoTakeScreenshot()) //DoTakeScreenshot() saves screenshot to the disk and returns its full path

Stacktrace: at AventStack.ExtentReports.Reporter.KlovReporter.InitMedia() at AventStack.ExtentReports.Reporter.KlovReporter.OnScreenCaptureAdded(Test test, ScreenCapture screenCapture) at AventStack.ExtentReports.Model.Report.<>c__DisplayClass26_0.b__0(IExtentReporter x) at System.Collections.Generic.List1.ForEach(Action1 action) at AventStack.ExtentReports.Model.Report.AddScreenCapture(Test test, ScreenCapture sc) at AventStack.ExtentReports.ExtentTest.AddScreenCaptureFromPath(String path, String title)

All the configurations are default. Running on windows 10, redis = MSOpenTech's redis v2.6.12 Klov 0.0.3

Iitialization code: internal class ExtentManager { private static readonly ExtentReports _instance = new ExtentReports();

static ExtentManager()
{
    KlovReporter klov = new KlovReporter();
    klov.InitMongoDbConnection(ConfigurationManager.AppSettings["ExtentXReportDBHost"],
        Int16.Parse(ConfigurationManager.AppSettings["ExtentXReportDBPort"]));
    klov.ReportName = "report name";
    klov.ProjectName = "project name;
    _instance.AttachReporter(klov);
}

public static ExtentReports Instance
{
    get { return _instance; }
}

}

and after that initialize reporter like Report = ExtentManager.Instance;

anshooarora commented 6 years ago

Thanks. I have found the issue. Testing a few scenarios now.

anshooarora commented 6 years ago

Please check with the latest if working for you -

ExtentReports.zip

SergeyC4 commented 6 years ago

It works. Thank you for quick fix and great support!

anshooarora commented 6 years ago

Version 3.1.1 now available with this fix.

https://www.nuget.org/packages/ExtentReports/3.1.1