我在visual studio C #中使用selenium处理ExtentReports,我运行了案例测试,但是报告文件。我在解决方案资源管理器中创建的报表文件夹中没有生成html。不知道问题出在哪里,我改了报告文件的路径去查,还是不生成。以下是我的代码:
using NUnit.Framework;
using RelevantCodes.ExtentReports;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ExtentReportsDemo
{
[TestFixture]
public class BasicReport
{
public ExtentReports extent;
public ExtentTest test;
[OneTimeSetUp]
public void StartReport()
{
string pth =
System.Reflection.Assembly.GetCallingAssembly().CodeBase;
string actualPath = pth.Substring(0, pth.LastIndexOf("bin"));
Console.WriteLine("actual" + actualPath);
string projectPath = new Uri(actualPath).LocalPath; // project path
of your solution
//Console.WriteLine("project" + projectPath);
string reportPath = projectPath + "Reports\\testreport.html";
Console.WriteLine("report" + reportPath);
// true if you want to append data to the report. Replace existing
report with new report. False to create new report each time
extent = new ExtentReports(reportPath, false);
extent.AddSystemInfo("Host Name", "MININT-F36S5EH")
.AddSystemInfo("Environment", "QA")
.AddSystemInfo("User Name", "testUser");
extent.LoadConfig(projectPath + "extent-config.xml");
}
[Test]
public void DemoReportPass()
{
test = extent.StartTest("DemoReportPass");
Assert.IsTrue(true);
test.Log(LogStatus.Pass, "Assert Pass as consition is true");
}
[Test]
public void DemoReportFail()
{
test = extent.StartTest("DemoReportPass");
Assert.IsTrue(false);
test.Log(LogStatus.Fail, "Assert Pass as condition is false");
}
[TearDown]
public void GetResult()
{
var status = TestContext.CurrentContext.Result.Outcome.Status;
var stackTrace = "<pre>" +
TestContext.CurrentContext.Result.StackTrace + "</pre>";
var errorMessage = TestContext.CurrentContext.Result.Message;
if (status == NUnit.Framework.Interfaces.TestStatus.Failed)
{
test.Log(LogStatus.Fail, stackTrace + errorMessage);
}
extent.EndTest(test);
}
[OneTimeTearDown]
public void EndReport()
{
extent.Flush();
extent.Close();
}
}
}
和extent-config.xml:
<?xml version="1.0" encoding="UTF-8"?>
<extentreports>
<configuration>
<!-- report theme -->
<!-- standard, dark -->
<theme>standard</theme>
<!-- document encoding -->
<!-- defaults to UTF-8 -->
<encoding>UTF-8</encoding>
<!-- protocol for script and stylesheets -->
<!-- defaults to https -->
<protocol>https</protocol>
<!-- title of the document -->
<documentTitle>ExtentReports 2.0</documentTitle>
<!-- report name - displayed at top-nav -->
<reportName>Automation Report</reportName>
<!-- report headline - displayed at top-nav, after reportHeadline -->
<reportHeadline></reportHeadline>
<!-- global date format override -->
<!-- defaults to yyyy-MM-dd -->
<dateFormat>yyyy-MM-dd</dateFormat>
<!-- global time format override -->
<!-- defaults to HH:mm:ss -->
<timeFormat>HH:mm:ss</timeFormat>
<!-- custom javascript -->
<scripts>
<![CDATA[
$(document).ready(function() {
});
]]>
</scripts>
<!-- custom styles -->
<styles>
<![CDATA[
]]>
</styles>
</configuration>
请首先通过静态位置尝试,如在任何驱动器C:\ORD:\中,并检查其生成,
如果没有,请通过更新报告终止调用来检查调试器。
此外,确保您的EndReport()
方法正在调用,其中报告终止在那里调用,
如果是这样,请尝试调用范围。结束测试(测试);
在 EndReport()
方法中,以便您可以检查其是否调用。
如果报告没有要求终止,则不会生成。
我快要把头发都拔出来了,有人请帮帮我。。 我正在使用JMeter 3.0,并试图从我的jtl文件中生成仪表板报告,但我得到错误消息- 我的user.properites文件包含- 这些值在jmeter.properties文件中也是相同的,只是为了确保我没有丢失任何东西... 我真的不明白为什么我不能让jtl包含标题,我遵循了我能找到的每一个指南,而且我似乎做得很好.. 有人能告诉我我遗漏了什么吗
我正在从事一个基于Selenium/testng/java/gradle的项目,该项目采用了针对webdriver和extenttest对象的ThreadLocal方法。每当我的测试用例失败时,我都会使用RetryListener再次运行失败的测试用例1次。若它是第二次通过,我的结果仍然在扩展报告中显示为“失败”(注意,所有迭代都记录在html报告中的单个测试节点中)。stackoverflow对
上面的代码用于生成allure报告并运行测试,它运行并生成reports-allure-results中的一个文件夹,其中包含JSON文件。见下方截图
问题内容: 我正在使用詹金斯(Jenkins)来进行将maven与黄瓜配合使用的工作。我的工作顺利进行。我还用jenkins管理了插件Cucumber报告。但是当我查看报告时,我收到如下图所示的消息。 我尝试安装各种插件,例如Jenkins插件,独立但没有任何乐趣。这些在选项的右下方显示为选项。 任何线索都是有帮助的。我也尝试过检查stackover流中的此错误。我没有任何线索 我可以看到由sur
我试图使用Extent报告(版本=“3.1.3”)为Selenium Webdriver C#生成HTML格式的报告,但在成功执行测试脚本后,我无法在指定的文件夹中看到HTML文件。 如果你能帮我找出问题所在并为这个问题提供解决方案,那就太好了。 提前感谢。 请在下面找到代码片段。 } 扩展配置. xml