running a geb test from a java class

前端 未结 3 1239
终归单人心
终归单人心 2021-01-22 18:22

I\'ve recently stumbled across geb and it looks like a good way to perform integration tests on our web applications. Our platforms are all java based and from reading that

3条回答
  •  日久生厌
    2021-01-22 18:50

    The best alternative to Geb if you're using Java is IMHO Selenide (http://selenide.org)

    example from Quick Start Guide:

    @Test
    public void userCanLoginByUsername() {
      open("/login");
      $(By.name("user.name")).setValue("johny");
      $("#submit").click();
      $(".loading_progress").should(disappear); // Waits until element disappears
      $("#username").shouldHave(text("Hello, Johny!")); // Waits until element gets text
    }
    

    It's independent from your testing framework and therefore can be used with e.g. JUnit, TestNG, Cucumber, ScalaTest, JBehave

提交回复
热议问题