谁有在c#中使用MSpec和Fluent Automation的例子?



当我调用I.Open("http://google.com");时,我无法使用"I"变量,因为它是从静态上下文中访问的。在最坏的情况下,我总是可以对selenium测试使用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");
}

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

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

最新更新