Closed brunoj1 closed 4 years ago
Since RazorEngine is a required dependency of ExtentReports, it would help if it supports .Net Core before any work happens from our end. It is currently an open issue on their end.. I would suggest opening a ticket for .NET core when RazorEngine is ready.
@anshooarora this may be closed
@anshooarora It looks like the RazorEngine project is on a hiatus https://github.com/Antaris/RazorEngine/issues/535#issuecomment-457597400. I don't suppose there are any plans on moving to a new one?
@anshooarora I feel we can keep this open as slow-burner until a resolution is in sight.
@vivek201 feel free to recommend alternatives that can be used
you can use https://www.nuget.org/packages/ExtentReports.Core
Very nice, i will.
you can use https://www.nuget.org/packages/ExtentReports.Core
worked for me! thanks
@felipeotarola @brunoj1 @Samil2018 when i try to use this package with Specflow 3 i get some warning like ScenarioContext.Current is obsolete
and although i don't get any error reports are not generated. Do you suggest anything ? or is purely that it does not support Specflow 3 yet ?
@MaheshGooner Yes it works, but as you say the method is obsolete, so you need to rewrite some. this is how I fixed that. `[Binding] public class TestInitialize { private static ExtentTest featureName; private static ExtentTest scenario; private static ExtentReports extent;
private Settings _settings;
private readonly ScenarioContext _scenarioContext;
private readonly IConfiguration _configuration;
public TestInitialize(Settings settings, ScenarioContext scenarioContext)
{
_settings = settings;
_scenarioContext = scenarioContext;
_configuration = new ConfigurationBuilder()
.AddJsonFile("appsettings.json")
.Build();
}
[BeforeScenario]
public void TestSetup()
{
_settings.BaseUrl = new Uri(_configuration["BaseUrl"]);
_settings.RestClient.BaseUrl = _settings.BaseUrl;
}
[BeforeTestRun]
public static void InitializeReport()
{
var solutionDir = Path.GetDirectoryName(Path.GetDirectoryName(TestContext.CurrentContext.TestDirectory));
var file = Path.Combine(solutionDir, "../..", "Reports", "ExtentReports", "ExtentReport.html");
var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, file);
var htmlReporter = new ExtentHtmlReporter(path);
extent = new ExtentReports();
extent.AttachReporter(htmlReporter);
}
[AfterTestRun]
public static void TearDownReport()
{
extent.Flush();
}
[BeforeFeature]
public static void BeforeFeature(FeatureContext featureContext)
{
featureName = extent.CreateTest<Feature>(featureContext.FeatureInfo.Title);
}
[AfterStep]
public void InsertReportingSteps()
{
var stepType = ScenarioStepContext.Current.StepInfo.StepDefinitionType.ToString();
if (_scenarioContext.TestError == null)
{
if (stepType == "Given")
scenario.CreateNode<Given>(ScenarioStepContext.Current.StepInfo.Text);
else if (stepType == "When")
scenario.CreateNode<When>(ScenarioStepContext.Current.StepInfo.Text);
else if (stepType == "Then")
scenario.CreateNode<Then>(ScenarioStepContext.Current.StepInfo.Text);
else if (stepType == "And")
scenario.CreateNode<And>(ScenarioStepContext.Current.StepInfo.Text);
}
else if (_scenarioContext.TestError != null)
{
if (stepType == "Given")
scenario.CreateNode<Given>(ScenarioStepContext.Current.StepInfo.Text).Fail(_scenarioContext.TestError.Message);
else if (stepType == "When")
scenario.CreateNode<When>(ScenarioStepContext.Current.StepInfo.Text).Fail(_scenarioContext.TestError.Message);
else if (stepType == "Then")
scenario.CreateNode<Then>(ScenarioStepContext.Current.StepInfo.Text).Fail(_scenarioContext.TestError.Message);
}
}
[BeforeScenario]
public void Initialize()
{
scenario = featureName.CreateNode<Scenario>(_scenarioContext.ScenarioInfo.Title);
}
}`
@felipeotarola can you please give the imports as well ? what are Settings ? ConfigurationBuilder() ?
In my case i have the following two classes
Hooks.cs
using System;
using AventStack.ExtentReports;
using AventStack.ExtentReports.Reporter;
using AventStack.ExtentReports.Gherkin.Model;
using TechTalk.SpecFlow;
using TechTalk.SpecFlow.Bindings;
using SbAutomation.ExtensionMethods;
namespace SbAutomation.Common
{
[Binding]
public class Hooks
{
private static ExtentTest _feature;
private static ExtentTest _scenario;
private static AventStack.ExtentReports.ExtentReports _extent;
private static readonly string PathReport = @"C:\Users\xxxx\Desktop\Automation\SbAutomation\ExtentReport.html";
[BeforeTestRun]
public static void ConfigureReport()
{
var reporter = new ExtentHtmlReporter(PathReport);
_extent = new AventStack.ExtentReports.ExtentReports();
_extent.AttachReporter(reporter);
}
[BeforeFeature]
public static void CreateFeature()
{
_feature = _extent.CreateTest<Feature>(FeatureContext.Current.FeatureInfo.Title);
}
[BeforeScenario]
public static void CreateScenario()
{
_scenario = _feature.CreateNode<Scenario>(ScenarioContext.Current.ScenarioInfo.Title);
}
[AfterStep]
public static void InsertReportingSteps()
{
switch (ScenarioStepContext.Current.StepInfo.StepDefinitionType)
{
case StepDefinitionType.Given:
_scenario.StepDefinitionGiven();
break;
case StepDefinitionType.Then:
_scenario.StepDefinitionThen();
break;
case StepDefinitionType.When:
_scenario.StepDefinitionWhen();
break;
}
}
[AfterTestRun]
public static void FlushExtent()
{
_extent.Flush();
System.Diagnostics.Process.Start(PathReport);
}
}
}
ScenarioExtensionMethods.cs
using System;
using AventStack.ExtentReports;
using AventStack.ExtentReports.Gherkin.Model;
using TechTalk.SpecFlow;
using TechTalk.SpecFlow.Bindings;
namespace SbAutomation.ExtensionMethods
{
public static class ScenarioExtensionMethod
{
private static ExtentTest CreateScenario(ExtentTest extent, StepDefinitionType stepDefinitionType)
{
var scenarioStepContext = ScenarioStepContext.Current.StepInfo.Text;
switch (stepDefinitionType)
{
case StepDefinitionType.Given:
return extent.CreateNode<Given>(scenarioStepContext);
case StepDefinitionType.Then:
return extent.CreateNode<Then>(scenarioStepContext);
case StepDefinitionType.When:
return extent.CreateNode<When>(scenarioStepContext);
default:
throw new ArgumentOutOfRangeException(nameof(stepDefinitionType), stepDefinitionType, null);
}
}
private static void CreateScenarioFailOrError(ExtentTest extent, StepDefinitionType stepDefinitionType)
{
var error = ScenarioContext.Current.TestError;
if (error.InnerException == null)
{
CreateScenario(extent, stepDefinitionType).Error(error.Message);
}
else
{
CreateScenario(extent, stepDefinitionType).Fail(error.InnerException);
}
}
public static void StepDefinitionGiven(this ExtentTest extent)
{
if (ScenarioContext.Current.TestError == null)
CreateScenario(extent, StepDefinitionType.Given);
else
CreateScenarioFailOrError(extent, StepDefinitionType.Given);
}
public static void StepDefinitionWhen(this ExtentTest extent)
{
if (ScenarioContext.Current.TestError == null)
CreateScenario(extent, StepDefinitionType.When);
else
CreateScenarioFailOrError(extent, StepDefinitionType.When);
}
public static void StepDefinitionThen(this ExtentTest extent)
{
if (ScenarioContext.Current.TestError == null)
CreateScenario(extent, StepDefinitionType.Then);
else
CreateScenarioFailOrError(extent, StepDefinitionType.Then);
}
}
}
I get the warning scenariocontext.current is obsolete please get the scenariocontext via context injection
in ScenarioExtensionMethods class with no errors. and it does not generate the report
@MaheshGooner Sorry this are my imports using ApiTests.Base; using AventStack.ExtentReports.Reporter; using System; using TechTalk.SpecFlow; using AventStack.ExtentReports; using AventStack.ExtentReports.Gherkin.Model; using System.IO; using Microsoft.Extensions.Configuration; using NUnit.Framework; using ConfigurationBuilder = Microsoft.Extensions.Configuration.ConfigurationBuilder; using RestSharp;
Settings and ConfigurationBuilder() are custom methods that I use in my framework. you can skip dem :)
It looks like you are missing
private readonly ScenarioContext _scenarioContext;
in your Hook Class.
And your CreateFeature should look like this.
[BeforeFeature]
public static void CreateFeature(FeatureContext featureContext)
{
_feature = _extent.CreateTest<Feature>(featureContext.FeatureInfo.Title);
}
@felipeotarola i still din't get it right. As my hooks class is static class i am unable to use context injection. do you have the complete example of the implementation of Extent reports for .net core ? sorry for asking too many details but i'm new to .net
Hi @felipeotarola, I tried following the steps that you have mentioned but I keep getting the below exception @extent.flush();... Any idea? thanks in advance
(I already have RazorEngine.NetCore added to the NuGet).
System.TypeLoadException
HResult=0x80131522
Message=Could not load type 'System.Security.Principal.WindowsImpersonationContext' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
Source=RazorEngine
StackTrace:
at RazorEngine.Compilation.DirectCompilerServiceBase.CompileType_Windows(TypeContext context)
at RazorEngine.Templating.RazorEngineCore.CreateTemplateType(ITemplateSource razorTemplate, Type modelType)
at RazorEngine.Templating.RazorEngineCore.Compile(ITemplateKey key, Type modelType)
at RazorEngine.Templating.RazorEngineService.CompileAndCacheInternal(ITemplateKey key, Type modelType)
at RazorEngine.Templating.RazorEngineService.GetCompiledTemplate(ITemplateKey key, Type modelType, Boolean compileOnCacheMiss)
at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
at RazorEngine.Templating.RazorEngineServiceExtensions.<>cDisplayClass16_0.1.ForEach(Action
1 action)
at AventStack.ExtentReports.Core.ExtentObservable.NotifyReporters()
at AventStack.ExtentReports.Core.ExtentObservable.Flush()
at AventStack.ExtentReports.ExtentReports.Flush()
at CSharpUI.steps.Hooks.After() 120
Very helpful guys, I migrated from 3 to 4, using .net core and trying to find a way to make it work but couldnt find any help anywhere.
Big help, thanks!
@archVille were you able to include screenshots to the extent reports ?
@archVille were you able to include screenshots to the extent reports ?
I havent reached that stage yet, but it is in my 'TODO' list as I previously had screenshots functionality implemented and need to migrate them with the same way. I will keep you posted - or if any of you implement this, just drop a message here.
Thanks @archVille. I don't get that working yet. I can take screenshot but it does not attch it to the report by calling test.Fail("details", MediaEntityBuilder.CreateScreenCaptureFromPath("screenshot.png").Build());
Would be helpful if someone gets that to work and post. Thanks
Did you guys got to run ExtentReports with .net core?
I installed a lot of packages Razor, extensions, etc, but even then I'm getting this error
Message=Could not load type 'System.Security.Principal.WindowsImpersonationContext'
Is there any way to run extent reports with .net core? Or it's not possible yet?
Please, help me
thank you very much!
yeah. i got that to work apart from not being able to attach screenshots. Below is my configuration
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using AventStack.ExtentReports.Reporter;
using NUnit.Framework;
using SbAutomation.Common;
namespace SbAutomation.Features
{
[SetUpFixture]
public class TestSetup
{
private readonly string _pathReport = $"{AppDomain.CurrentDomain.BaseDirectory}index.html";
[OneTimeSetUp]
public void RunBeforeAnyTests()
{
var reporter = new ExtentHtmlReporter(_pathReport);
Hooks.Extent = new AventStack.ExtentReports.ExtentReports();
Hooks.Extent.AttachReporter(reporter);
}
[OneTimeTearDown]
public void RunAfter()
{
Hooks.Extent.Flush();
//TODO: this should be wrapped into more platform agnostic code. Also commented to avoid error on gitlab-ci
//Process.Start(@"cmd.exe ", $@"/c {AppDomain.CurrentDomain.BaseDirectory}index.html");
}
}
}
using System;
using TechTalk.SpecFlow;
using TechTalk.SpecFlow.Bindings;
using AventStack.ExtentReports;
using AventStack.ExtentReports.Gherkin.Model;
using AventStack.ExtentReports.Reporter;
using SbAutomation.ExtensionMethods;
namespace SbAutomation.Common
{
[Binding]
public class Hooks
{
private static ExtentTest _feature;
private static ExtentTest _scenario;
public static AventStack.ExtentReports.ExtentReports Extent;
//private static readonly ScenarioContext _scenarioContext;
[BeforeTestRun]
public static void ConfigureReport()
{
}
[BeforeFeature]
public static void CreateFeature(FeatureContext featureContext)
{
_feature = Extent.CreateTest<Feature>(featureContext.FeatureInfo.Title);
}
[BeforeScenario]
public static void CreateScenario(ScenarioContext _scenarioContext)
{
_scenario = _feature.CreateNode<Scenario>(_scenarioContext.ScenarioInfo.Title);
}
[AfterStep]
public static void InsertReportingSteps()
{
switch (ScenarioStepContext.Current.StepInfo.StepDefinitionType)
{
case StepDefinitionType.Given:
_scenario.StepDefinitionGiven();
break;
case StepDefinitionType.Then:
_scenario.StepDefinitionThen();
break;
case StepDefinitionType.When:
_scenario.StepDefinitionWhen();
break;
}
}
[AfterTestRun]
public static void FlushExtent()
{
}
}
}
sorry for being lazy and pasting all the dependencies
<ItemGroup>
<PackageReference Include="Nunit" Version="3.11.0" />
<PackageReference Include="NUnit.Console" Version="3.10.0" />
<PackageReference Include="NUnit.ConsoleRunner" Version="3.10.0" />
<PackageReference Include="NUnit.Extension.NUnitV2Driver" Version="3.7.0" />
<PackageReference Include="NUnit.Extension.NUnitV2ResultWriter" Version="3.6.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.13.0" />
<PackageReference Include="Selenium.WebDriver" Version="3.141.0" />
<PackageReference Include="Selenium.Chrome.WebDriver" Version="76.0.0" />
<PackageReference Include="BoDi" Version="1.4.1" />
<PackageReference Include="SpecFlow" Version="3.0.220" />
<PackageReference Include="HtmlAgilityPack" Version="1.8.4" />
<PackageReference Include="SpecFlow.Tools.MsBuild.Generation" Version="3.0.220" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.1" />
<PackageReference Include="System.Buffers" Version="4.5.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.5.0" />
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
<PackageReference Include="gherkin" Version="6.0.0" />
<PackageReference Include="Utf8Json" Version="1.3.7" />
<PackageReference Include="HttpClientFactory" Version="1.0.1" />
<PackageReference Include="unirest-netcore20" Version="1.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
<PackageReference Include="ExtentReports.Core" Version="1.0.2" />
<PackageReference Include="MongoDB.Bson" Version="2.8.1" />
<PackageReference Include="MongoDB.Driver" Version="2.8.1" />
<PackageReference Include="MongoDB.Driver.Core" Version="2.8.1" />
<PackageReference Include="RazorEngine.NetCore" Version="2.2.2" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.5.0" />
</ItemGroup>
@MaheshGooner , I'm using x unit, so I don't have [BeforeTestRun], [BeforeFeature] annotations, so I will try to do the same you did.
So, did you download nuget all of these packages below using nuget? These are the required packages to run the Extent Reports?
<PackageReference Include="ExtentReports.Core" Version="1.0.2" />
<PackageReference Include="MongoDB.Bson" Version="2.8.1" />
<PackageReference Include="MongoDB.Driver" Version="2.8.1" />
<PackageReference Include="MongoDB.Driver.Core" Version="2.8.1" />
<PackageReference Include="RazorEngine.NetCore" Version="2.2.2" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.5.0" />
thanks!
@lucascologni That's correct. And yeah i used Nunit Test project.
Hi, I got to generate the extent reports, but it's generating 2 files.
index.html dashboard.html
But I created with the name "ReportTest.html" but the name was not set.
Do you know what can it be ?
public static void CreateReport(string reportName)
{
ExtentHtmlReporter extentHtmlReporter = new ExtentHtmlReporter(GetReportsClassLibraryPath() + reportName + ".html");
_extentReport = new AventStack.ExtentReports.ExtentReports();
_extentReport.AttachReporter(extentHtmlReporter);
AddReportSystemInfo();
var test = _extentReport.CreateTest("ExtentTestCase");
test.Log(Status.Info, "Step 1: Test Case Starts.");
test.Log(Status.Pass, "Step 1: Test Case for Pass.");
test.Log(Status.Fail, "Step 3: Test Case Failed.");
_extentReport.Flush();
}
private static string GetReportsClassLibraryPath() => Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "..\..\..\");
Thanks!
Which version of ExtentReports this fix is available in?
Which version of ExtentReports this fix is available in?
Are you talking about the report name that is not applying ? If so, I coudn't find any answer about it
Which version of ExtentReports this fix is available in?
Are you talking about the report name that is not applying ? If so, I coudn't find any answer about it
I am struggling with Visual Studio code with an issue. Following is the project file
And I get following error on report.Flush();
System.TypeLoadException : Could not load type 'System.Security.Principal.WindowsImpersonationContext' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
Stack Trace:
at RazorEngine.Compilation.DirectCompilerServiceBase.CompileType_Windows(TypeContext context)
at RazorEngine.Compilation.DirectCompilerServiceBase.CompileType(TypeContext context)
at RazorEngine.Templating.RazorEngineCore.CreateTemplateType(ITemplateSource razorTemplate, Type modelType)
at RazorEngine.Templating.RazorEngineCore.Compile(ITemplateKey key, Type modelType)
at RazorEngine.Templating.RazorEngineService.CompileAndCacheInternal(ITemplateKey key, Type modelType)
at RazorEngine.Templating.RazorEngineService.GetCompiledTemplate(ITemplateKey key, Type modelType, Boolean compileOnCacheMiss)
at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
at RazorEngine.Templating.DynamicWrapperService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String name, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
at RazorEngine.Templating.RazorEngineServiceExtensions.<>cDisplayClass16_0.1.ForEach(Action
1 action)
at AventStack.ExtentReports.Core.ExtentObservable.NotifyReporters()
at AventStack.ExtentReports.Core.ExtentObservable.Flush()
at AventStack.ExtentReports.ExtentReports.Flush()
at TestAutomation.LogMe.CloseReport() in d:\Users\mohd.saquib\CSharpProjectUsingVSC\Core\LogMe.cs:line 88
at TestAutomation.TestAmex.TC_01_Amex_CardTitle() in d:\Users\mohd.saquib\CSharpProjectUsingVSC\TestAmex.cs:line 36
Test Run Failed. Total tests: 1 Failed: 1 Total time: 51.3778 Seconds
Thanks @archVille. I don't get that working yet. I can take screenshot but it does not attch it to the report by calling
test.Fail("details", MediaEntityBuilder.CreateScreenCaptureFromPath("screenshot.png").Build());
Would be helpful if someone gets that to work and post. Thanks
@MaheshGooner Is the attachment issue fixed?? Any workaround exist
Thanks @archVille. I don't get that working yet. I can take screenshot but it does not attch it to the report by calling
test.Fail("details", MediaEntityBuilder.CreateScreenCaptureFromPath("screenshot.png").Build());
Would be helpful if someone gets that to work and post. Thanks@MaheshGooner Is the attachment issue fixed?? Any workaround exist
@vinuthakbapu I have not worked on it after that so no update. But if you can get it work do let me know please. Would be useful
Official .NET Core/Standard release will be available soon. Some ports from the Java version are now available too. Initial:
https://github.com/extent-framework/extentreports-csharp/tree/net-core
Support for .Net Core/Standard is available starting 4.1.0-alpha.
@anshooarora Is the alpha package available anywhere, potentially as a pre-release to try out?
Hi, I got to generate the extent reports, but it's generating 2 files.
index.html dashboard.html
But I created with the name "ReportTest.html" but the name was not set.
Do you know what can it be ?
public static void CreateReport(string reportName) { ExtentHtmlReporter extentHtmlReporter = new ExtentHtmlReporter(GetReportsClassLibraryPath() + reportName + ".html"); _extentReport = new AventStack.ExtentReports.ExtentReports(); _extentReport.AttachReporter(extentHtmlReporter); AddReportSystemInfo(); var test = _extentReport.CreateTest("ExtentTestCase"); test.Log(Status.Info, "Step 1: Test Case Starts."); test.Log(Status.Pass, "Step 1: Test Case for Pass."); test.Log(Status.Fail, "Step 3: Test Case Failed."); _extentReport.Flush(); }
private static string GetReportsClassLibraryPath() => Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "......\");
Thanks!
Did you get solution to this? I am facing the same issue
Which version of ExtentReports this fix is available in?
Are you talking about the report name that is not applying ? If so, I coudn't find any answer about it
I am struggling with Visual Studio code with an issue. Following is the project file
Exe netcoreapp3 And I get following error on report.Flush();
System.TypeLoadException : Could not load type 'System.Security.Principal.WindowsImpersonationContext' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Stack Trace: at RazorEngine.Compilation.DirectCompilerServiceBase.CompileType_Windows(TypeContext context) at RazorEngine.Compilation.DirectCompilerServiceBase.CompileType(TypeContext context) at RazorEngine.Templating.RazorEngineCore.CreateTemplateType(ITemplateSource razorTemplate, Type modelType) at RazorEngine.Templating.RazorEngineCore.Compile(ITemplateKey key, Type modelType) at RazorEngine.Templating.RazorEngineService.CompileAndCacheInternal(ITemplateKey key, Type modelType) at RazorEngine.Templating.RazorEngineService.GetCompiledTemplate(ITemplateKey key, Type modelType, Boolean compileOnCacheMiss) at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag) at RazorEngine.Templating.DynamicWrapperService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag) at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String name, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag) at RazorEngine.Templating.RazorEngineServiceExtensions.<>cDisplayClass16_0.b0(TextWriter writer) at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter) at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag) at AventStack.ExtentReports.Reporter.ExtentHtmlReporter.Flush(ReportAggregates reportAggregates) at AventStack.ExtentReports.Core.ExtentObservable.<>cDisplayClass59_0.
b 0(IExtentReporter x) at System.Collections.Generic.List1.ForEach(Action
1 action) at AventStack.ExtentReports.Core.ExtentObservable.NotifyReporters() at AventStack.ExtentReports.Core.ExtentObservable.Flush() at AventStack.ExtentReports.ExtentReports.Flush() at TestAutomation.LogMe.CloseReport() in d:\Users\mohd.saquib\CSharpProjectUsingVSC\Core\LogMe.cs:line 88 at TestAutomation.TestAmex.TC_01_Amex_CardTitle() in d:\Users\mohd.saquib\CSharpProjectUsingVSC\TestAmex.cs:line 36Test Run Failed. Total tests: 1 Failed: 1 Total time: 51.3778 Seconds
Was there ever a solution for this?
Hi, I got to generate the extent reports, but it's generating 2 files.
index.html dashboard.html
But I created with the name "ReportTest.html" but the name was not set.
Do you know what can it be ?
public static void CreateReport(string reportName) { ExtentHtmlReporter extentHtmlReporter = new ExtentHtmlReporter(GetReportsClassLibraryPath() + reportName + ".html"); _extentReport = new AventStack.ExtentReports.ExtentReports(); _extentReport.AttachReporter(extentHtmlReporter); AddReportSystemInfo(); var test = _extentReport.CreateTest("ExtentTestCase"); test.Log(Status.Info, "Step 1: Test Case Starts."); test.Log(Status.Pass, "Step 1: Test Case for Pass."); test.Log(Status.Fail, "Step 3: Test Case Failed."); _extentReport.Flush(); }
private static string GetReportsClassLibraryPath() => Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "......\");
Thanks!
you can use ExtentV3HtmlReporter instead of ExtentHtmlReporter and it will be ok. it worked for me
Hi, I got to generate the extent reports, but it's generating 2 files. index.html dashboard.html But I created with the name "ReportTest.html" but the name was not set. Do you know what can it be ?
public static void CreateReport(string reportName) { ExtentHtmlReporter extentHtmlReporter = new ExtentHtmlReporter(GetReportsClassLibraryPath() + reportName + ".html"); _extentReport = new AventStack.ExtentReports.ExtentReports(); _extentReport.AttachReporter(extentHtmlReporter); AddReportSystemInfo(); var test = _extentReport.CreateTest("ExtentTestCase"); test.Log(Status.Info, "Step 1: Test Case Starts."); test.Log(Status.Pass, "Step 1: Test Case for Pass."); test.Log(Status.Fail, "Step 3: Test Case Failed."); _extentReport.Flush(); }
private static string GetReportsClassLibraryPath() => Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "......"); Thanks!
you can use ExtentV3HtmlReporter instead of ExtentHtmlReporter and it will be ok. it worked for me
How you manage to use ExtentV3HtmlReporter with .NET core? if I just change ExtentHtmlReporter for ExtentV3HtmlReporter I get error
I used extent report for .net core https://www.nuget.org/packages/ExtentReports.Core/
From: Christophe notifications@github.com Sent: Thursday, March 12, 2020 5:13 PM To: extent-framework/extentreports-csharp extentreports-csharp@noreply.github.com Cc: Anuj Singh Anuj.Singh@bentley.com; Comment comment@noreply.github.com Subject: Re: [extent-framework/extentreports-csharp] Support for .NET Core (#43)
Hi, I got to generate the extent reports, but it's generating 2 files. index.html dashboard.html But I created with the name "ReportTest.html" but the name was not set. Do you know what can it be ?
public static void CreateReport(string reportName)
{
ExtentHtmlReporter extentHtmlReporter = new ExtentHtmlReporter(GetReportsClassLibraryPath() + reportName + ".html");
_extentReport = new AventStack.ExtentReports.ExtentReports();
_extentReport.AttachReporter(extentHtmlReporter);
AddReportSystemInfo();
var test = _extentReport.CreateTest("ExtentTestCase");
test.Log(Status.Info, "Step 1: Test Case Starts.");
test.Log(Status.Pass, "Step 1: Test Case for Pass.");
test.Log(Status.Fail, "Step 3: Test Case Failed.");
_extentReport.Flush();
}
private static string GetReportsClassLibraryPath() => Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "......"); Thanks!
you can use ExtentV3HtmlReporter instead of ExtentHtmlReporter and it will be ok. it worked for me
How you manage to use ExtentV3HtmlReporter with .NET core? if I just change ExtentHtmlReporter for ExtentV3HtmlReporter I get error
— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_extent-2Dframework_extentreports-2Dcsharp_issues_43-23issuecomment-2D598142334&d=DwMCaQ&c=hmGTLOph1qd_VnCqj81HzEWkDaxmYdIWRBdoFggzhj8&r=18UKqRJ5qxpJbabnAfUWAdcS6_uO6lsyxtQKlrV8mMA&m=z7HT_qRjtBhKhAGhjvUCr5ObgVc462W5dx6vseCVHzY&s=CzLJDMD6cuDrsGvWoPeBQGMhSDmc3Y89yDCyjAb33yo&e=, or unsubscribehttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AFU2PFOH7LINCDSAJ7OQ32DRHDDFNANCNFSM4G2AGJXA&d=DwMCaQ&c=hmGTLOph1qd_VnCqj81HzEWkDaxmYdIWRBdoFggzhj8&r=18UKqRJ5qxpJbabnAfUWAdcS6_uO6lsyxtQKlrV8mMA&m=z7HT_qRjtBhKhAGhjvUCr5ObgVc462W5dx6vseCVHzY&s=BWVPx1aW1-qx_d2S8TF9Jay8iZpz8ODEfT6WveVdhqQ&e=.
extent.AttachReporter(htmlReporter);
Not working For me, Can you tell me How to use that.
Hi All, I'm facing issue to generate Extent report or .netCore project. I have read above message and have installed ExtentReports.Core package, but the thing is at the teardown, extent.flush is not working, have error message"System.IO.FileNotFoundException : Could not load file or assembly 'System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified." and it's not generating html report. does anyone can help me out for this. thanks in advance. My code looks like: [OneTimeSetUp] protected void Setup() { var solutionDir = Path.GetDirectoryName(Path.GetDirectoryName(TestContext.CurrentContext.TestDirectory)); var file = Path.Combine(solutionDir, "../..", "Reports", "ExtentReports", "ExtentReport.html"); var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, file); var htmlReporter = new ExtentHtmlReporter(path); _extent = new ExtentReports(); _extent.AttachReporter(htmlReporter);
}
[OneTimeTearDown]
protected void TearDown()
{
_extent.Flush();
}
[test] public void test1(){ _test = _extent.CreateTest(TestContext.CurrentContext.Test.Name); ..... ... }
Hi All, I'm facing issue to generate Extent report or .netCore project. I have read above message and have installed ExtentReports.Core package, but the thing is at the teardown, extent.flush is not working, have error message"System.IO.FileNotFoundException : Could not load file or assembly 'System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified." and it's not generating html report. does anyone can help me out for this. thanks in advance. My code looks like: [OneTimeSetUp] protected void Setup() { var solutionDir = Path.GetDirectoryName(Path.GetDirectoryName(TestContext.CurrentContext.TestDirectory)); var file = Path.Combine(solutionDir, "../..", "Reports", "ExtentReports", "ExtentReport.html"); var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, file); var htmlReporter = new ExtentHtmlReporter(path); _extent = new ExtentReports(); _extent.AttachReporter(htmlReporter);
} [OneTimeTearDown] protected void TearDown() { _extent.Flush(); }
[test] public void test1(){ _test = _extent.CreateTest(TestContext.CurrentContext.Test.Name); ..... ... }
This is fixed in latest dll of ExtentReports 4.1.0 beta1
Good Morning,
I run my selenium tests in a .NET Core project using Extent Reports 4.1.0 and my reports are generating successfully. However, the "Passed %" does not display if I have failed tests. It only displays if all the tests pass.
Any suggestions?
Hello,
I´m having trouble to implement ExtentReport on a .NET Core application, only the RazorEngine package is on .NET Framework. There is any sollution for this problem?
Thanks in advance