c# - 带有 SpecFlow 挂钩的 NuGet 包
问题描述
我创建了一个 SpecFlow 挂钩类来在 BDD Specflow C# 项目中生成范围报告。它工作正常并且生成了报告。
[BeforeTestRun]
public static void InitializeReport()
{
//Initialize Extent report before test starts
var htmlReporter = new ExtentHtmlReporter(reportPath);
htmlReporter.Config.Theme = Theme.Dark;
//Attach report to reporter
extent = new AventStack.ExtentReports.ExtentReports();
extent.AttachReporter(htmlReporter);
}
[AfterTestRun]
public static AfterTests()
{
//Flush report once test completes
extent.Flush();
}
为了重用它,我将其作为 NuGet 库并导入另一个项目。但是报告没有生成。我们是否需要为 hooks 类创建对象来调用它?谁能建议在这种情况下如何触发 SpecFlow 钩子。
解决方案
我昨天遇到了这个问题。您需要将 Specflow 更新到最新版本 Specflow 3.0.x 仍然存在[AfterTestRun]
未执行挂钩的错误(多年来)。
推荐阅读
- java - 如何从whatsapp获取pdf文件数据到我在android中的应用程序?
- selenium-chromedriver - 如何在 VBA 中使用 Selenium 从文本框中清除值
- stl - 如何从 numpy-stl 网格中提取顶点?
- javascript - 将 $.ajax 请求重写为 JavaScript XMLHttpRequest
- prestashop-1.7 - 在自定义控制器上找不到 prestashop 1.7 类
- javascript - Google Places API 适用于 Chrome,但不适用于 Firefox
- ionic-framework - ( Yii2 Framework + Ionic ) 中的跨域请求 (CORS)
- javascript - 如何找到在 asp:repeater 中选择了哪个产品,因为我想将这个选定的产品添加到购物车中
- c++ - 节点小于和大于某个节点的节点数
- c# - C# XmlSerializer.Deserialize 因某些命名空间而失败