【问题标题】:Does anyone have an example of using MSpec with Fluent Automation in C#?有没有人有在 C# 中使用 MSpec 和 Fluent Automation 的示例?
【发布时间】:2014-08-23 23:35:57
【问题描述】:

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

【问题讨论】:

    标签: c# selenium selenium-webdriver mspec fluentautomation


    【解决方案1】:

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

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

    【讨论】:

    • 很高兴为您服务 ;-)
    猜你喜欢
    • 2022-11-15
    • 1970-01-01
    • 2010-10-03
    • 2022-11-09
    • 1970-01-01
    • 1970-01-01
    • 2013-05-16
    • 1970-01-01
    • 2012-02-22
    相关资源
    最近更新 更多