1

我在调用时无法使用“I”变量,I.Open("http://google.com");因为它是从静态上下文访问的。在最坏的情况下,我总是可以将 MSTest 用于硒测试,将 MSpec 用于所有其他测试。

[Tags("Easy","Web")]
[Subject("Verify we can reach google.com.")]
public class ViewGoogleTest: FluentTest
{
    IActionSyntaxProvider result;

    Establish context = () =>
    {
        SeleniumWebDriver.Bootstrap(SeleniumWebDriver.Browser.Chrome);
    };

    Because of = () =>
    {
        result = I.Open("http://google.com");
    };

    It should_display_the_page = () => result.Find("#SomeId");
}
4

1 回答 1

0

我找到了一个例子。基本上,您创建了一个 Selenium 实例,而不是 Fluent Automation 文档中显示的默认继承。

https://github.com/agross/mspec-samples/blob/master/WebSpecs/LoginApp.Selenium.Specs/LoginSpecs.cs

于 2014-07-03T02:17:17.543 回答