有没有人有一个在C#中使用MSpec和Fluent Automation的例子?

时间:2014-07-03 01:33:49

标签: c# selenium selenium-webdriver mspec fluentautomation

我无法使用"我"我调用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");
}

1 个答案:

答案 0 :(得分:0)

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

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