Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Selenide vs Geb

Selenide vs Geb

Presentation slide which is presented on JJUG CCC 2016 Spring Night Meetup.
日本語版はこちら:https://speakerdeck.com/poohsunny/seleniumtogeb

PoohSunny

May 21, 2016
Tweet

More Decks by PoohSunny

Other Decks in Technology

Transcript

  1. Selenide vs Geb

    View Slide

  2. @PoohSunny
    {
    role : father
    children : 2
    work : house keeping
    }

    View Slide

  3. lots of browser
    automation tools!

    View Slide

  4. How do we
    decide which to
    use !?

    View Slide

  5. Talk Selenide & Geb
    commiters1
    in github issue
    1 https://github.com/codeborne/selenide/issues/65

    View Slide

  6. Read the talk and
    diffenciate them!

    View Slide

  7. NOTE:
    this talk was held around
    2 yrs ago.

    View Slide

  8. @Before
    write sample code with both
    tools
    • move to google search page
    • enter"Selenide" or "Geb"
    • assert page should have 10 records
    • assert first record include searched word.

    View Slide

  9. Selenide2
    public class GoogleTest {
    @Test
    public void userCanSearch() {
    GooglePage page = open("http://google.com/",
    GooglePage.class);
    SearchResultsPage results = page.searchFor("selenide");
    results.getResults().shouldHave(size(10));
    results.getResult(0).shouldHave(text("Selenide"));
    }
    }
    2 https://github.com/selenide-examples/google/blob/master/test/org/selenide/examples/
    google/selenidepageobject/GoogleTest.javaΛϕʔεʹҰ෦มߋ

    View Slide

  10. Geb
    @RunWith(JUnit4)
    public class GoogleTest extend GebTest {
    @Test
    def userCanSearch() {
    to GooglePage
    searchFor("Geb")
    at SearchResultsPage
    assert results.size() == 10
    assert results[0].text().contains("Geb")
    }
    }

    View Slide

  11. handling wait
    Selenide
    $("#resultDiv").shouldBe(visible);
    Geb
    waitFor { theResultDiv.present }
    Selenide waits automatically.

    View Slide

  12. pure Java ?
    Selenide: Yes!
    Geb: No!

    View Slide

  13. Comment from
    Geb commiter
    You can use WebDriver's
    implicit wait stuff, but I
    don't publicise it.
    It makes developing/debugging painful
    and trying to sweep asynchronicity under
    the rug doesn't work in practice in my
    experience.

    View Slide

  14. Comment from
    Geb commiter
    If Geb were remade to
    avoid dynamism, it
    wouldn't be recognisable
    as Geb as you say.

    View Slide

  15. Comment from Selenide
    commiter
    • implicit wait doesn't work well
    • can only wait for element to appear.
    • Selenide does it's own waiting mechanism.
    • you can also wait for element even dissapper
    $("#resultDiv").shouldHave(text("Hello"));
    $(".error").should(disappear);

    View Slide

  16. Summary
    Selenide
    • Java
    • No need to consider about waiting
    Geb
    • Groovy
    • Need to write waiting explicitly

    View Slide

  17. Both hate
    implicit wait

    View Slide

  18. Fin.

    View Slide