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