extent-framework / extentreports-csharp

Extent Reporting Library, .NET
http://extentreports.com
Apache License 2.0
50 stars 40 forks source link

Issue compiling template running on macOS Catalina 10.15.5 #95

Closed bgoggan closed 3 years ago

bgoggan commented 4 years ago

I have ExtentReports.Core v1.0.2 implemented on a .Net core test suite (core v3.0) and when I execute the tests on a mac with the above mentioned OS I receive the following error when trying to generate the test report results. Is there support for using Extent Reports on macOS/Linux? I understand the overall issue is with the RazorEngine template but since that is a dependency of the extent report library I'm posting the issue/question here. I've read about having to either fork the RazorEngine project and make a change to the code or use RazorLight. Thanks

Error Message: TearDown : RazorEngine.Templating.TemplateCompilationException : Errors while compiling a Template. Please try the following to solve the situation:

anshooarora commented 4 years ago

@bgoggan I will look into this and update you. By the way, the package you are using has been created by the SimplyTest team. Packages I create are available here: https://www.nuget.org/packages/ExtentReports/4.1.0-beta1

bgoggan commented 4 years ago

@anshooarora thank you for your time with it. If I need to re-direct elsewhere I don't mind doing that.

anshooarora commented 4 years ago

I ran it on Catalina and the package I mentioned works without any issues. I did however face an issue while installing this package, for which I had to install Newtonsoft.Json first, followed by ExtentReports 4.1.0-beta1. I will fix this issue and try to push the release version by tomorrow.

bgoggan commented 4 years ago

@anshooarora sounds good. One additional question. Does the package you mentioned support .net Core 3.0? I believe that's why I originally switched to the package I'm using now because previous versions didn't.

anshooarora commented 4 years ago

@bgoggan Please use this: https://www.nuget.org/packages/ExtentReports/4.1.0. This package is built as a .NET Standard 2.0 library. The previous versions were targeting .NET Framework which is why but all development starting release 4.1.0 will target .NET Core/Standard.

bgoggan commented 4 years ago

@anshooarora Thabk you. I will update my version in the morning and let you know. Much appreciated

bgoggan commented 4 years ago

@anshooarora So, I updated my package this morning to the one mentioned and prior to testing the creation on my mac machine I ran a test on windows as a regression. Previously I was creating the report with a specific name, using the "Nam" attribute from the test context. For whatever reason now the test report just ends up being named, "index.html". My code is below. Is there something different in the CreateTest method is this package than what I may have been doing before? I validated the TestContext Name value is present. ` currentDir = Directory.GetCurrentDirectory(); ParentDir = Directory.GetParent(currentDir).Parent.FullName; Directory.CreateDirectory(Path.Combine(ParentDir, "AutoResults")); FileName = Hooks.TestContext.Test.Name + "_" + DateTime.Now.ToString("yyyy-mm-dd-HHmmss") + ".html"; var htmlReporter = new ExtentHtmlReporter(Path.Combine(ParentDir, "AutoResults", FileName)); FilePath = Path.Combine(ParentDir, "AutoResults", FileName);

        report = new ExtentReports();
        report.AttachReporter(htmlReporter);

        htmlReporter.LoadConfig(Path.Combine(currentDir, "extent-config.xml"));

        **test = report.CreateTest(TestContext.CurrentContext.Test.Name);`**
bgoggan commented 4 years ago

@anshooarora Hey, so it appears the issue comes from switching the ExtentV3HtmlReporter to just the ExtentHtmlReporter, which I see is necessary with version 4. I looked at the documentation and I don't see how I'm using it incorrectly but maybe I am.