【问题标题】:QAF - wanted to open and close the browser with each testQAF - 想在每次测试时打开和关闭浏览器
【发布时间】:2019-01-05 01:26:27
【问题描述】:

我在我的 UI 自动化框架中使用 QAF 开源 Java 库,并希望在每次测试时打开和关闭浏览器。但是,无法使用下面的代码执行此操作,因此由 testSuccessfulLogin() 打开的浏览器保持打开状态,因此 testFailedLogin() 失败。

public class LoginTestCase extends WebDriverTestCase {
    @Test(testName="SuccessfulLogin", description="Successful Login with valid username and password",  groups={"SMOKE"})
    public void testSuccessfulLogin() {
        LoginPage loginPage = new LoginPage();

        loginPage.openPage();
        verifyLinkWithTextPresent("Or Sign Up");

        loginPage.enterUsername("asdf.asdf");
        loginPage.enterPassword("Asdf@1234");
        loginPage.clickLogInButton();

        verifyLinkWithTextPresent("Dashboard");
        verifyLinkWithTextPresent("Logout");
    }

    @Test(testName="FailedLogin", description="Login with blank username and password", groups={"SMOKE"})
    public void testFailedLogin() {
        LoginPage loginPage = new LoginPage();      

        loginPage.openPage();
        verifyLinkWithTextPresent("Or Sign Up");

        loginPage.enterUsername("");
        loginPage.enterPassword("");
        loginPage.submitLoginForm();

        verifyLinkWithTextPresent("Dashboard");
        verifyLinkWithTextPresent("Logout");
    }
}

【问题讨论】:

    标签: selenium ui-automation qaf


    【解决方案1】:

    你可以通过设置selenium.singletone=method来实现。在应用程序属性或 xml 配置文件中指定它。参考list of propertieshow to set properties

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-10
      • 1970-01-01
      • 2015-06-29
      • 1970-01-01
      相关资源
      最近更新 更多