我最近将一个项目从 NUnit 切换到 xUnit,以便可以使用 ITestOutputHelper 输出到日志。
该项目是一个相当标准的布局
功能文件->步骤类->页面类->帮助类。在辅助类中我们还有 hooks.class。我正在使用 xUnit 运行程序。
所以在我的 hooks 类中我创建了这个
private readonly ScenarioContext _scenarioContext;
private ITestOutputHelper _testOutputHelper;
public Hooks(ScenarioContext scenarioContext, ITestOutputHelper testOutputHelper)
{
_scenarioContext = scenarioContext;
this._testOutputHelper = testOutputHelper;
}
public void WriteOutput(string theMessage)
{
_testOutputHelper.WriteLine(theMessage);
}
Run Code Online (Sandbox Code Playgroud)
现在我的问题是如何从其他类访问 WriteOutput 函数?或者我把它放在错误的班级里了?
我正在使用 Watir 6.16,我遇到了这行代码
<div data-guid="SearchTitle" class="acme"></div>
Run Code Online (Sandbox Code Playgroud)
不知道如何在 Watir 中找到这样的元素,我已经尝试过 -
element(:search_title, custom_attribute: "SearchTitle")
Run Code Online (Sandbox Code Playgroud)
但这没有返回任何内容,所以我被迫使用 xpath 还是还有其他方法?
凯夫