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

Modern UI Test Automation with Selenium Libraries

Modern UI Test Automation with Selenium Libraries

End-to-end testing is a common testing methodology where the objective is to test how an application works by checking user scenarios from start to finish. Usually, it is not that easy to write and maintain these tests. Fortunately, we have Selenium, a rock-solid ecosystem where you can find almost everything for UI automation, both for web and mobile testing.
In this live stream, we will talk about modern approaches to UI test automation with Selenium and Java. Let’s see if setting up e2e tests is easy or not, and how we can do it better.

Speaker: Yuriy Artamonov
Yuriy has been developing libraries, frameworks, and tools for developers for the past 10 years. As part of his academic activities, he mentored Applied Mathematics students at Samara University.
As a member of the JetBrains IntelliJ IDEA team, Yuriy is fascinated with introducing useful new tools to the daily routine of millions of developers. He is the author of the Selenium UI Testing plugin and maintainer of Gauge support for IntelliJ IDEA.

Yuriy Artamonov

May 28, 2021

More Decks by Yuriy Artamonov

Other Decks in Programming


  1. Author @Yuriy_Artamonov ▪ Developing libraries, frameworks, and tools for developers

    for the past 10 years ▪ Sad about their imperfect IDE support ▪ Working in IntelliJ IDEA team on Selenium UI Testing plugin. 2
  2. Topics — 1.Setting up Selenium and WebDriver 2.Running code 3.Modern

    APIs on top of Selenium 4.Reporting Libraries 5.Running Selenium on CI 6.Tooling and helpful resources 3
  3. Selenium Basics — Selenium is: 1. Ecosystem of UI testing

    tools 2. User-agent library 3. Contiuous integration tools 6
  4. Getting Started — 1. Install Selenium plugin for IntelliJ IDEA

    2. Create a new project 3. Write tests! 7
  5. Setting up Driver Binary — 1. Download webdriver binary, compatible

    with a local browser 2. Specify path to webdriver binary in tests: System.setProperty(“webdriver.chrome.driver”, “/path/to/binary/chromedriver”); No way! We can do this better with WebDriverManager: io.github.bonigarcia:webdrivermanager:4.4.3 Must-have library for managing drivers! 8
  6. Modern APIs on top of Selenium — Top 3 productive

    APIs to write your UI tests: 1.Selenide (Java/Kotlin/Groovy) 2.FluentLenium (Java/Groovy) 3.Geb (Groovy) 9
  7. Selenide — 1.Concise fluent APIs 2.AJAX support 3.Powerful selectors 4.Simple

    configuration 5. WebDriverManager Out-of-the-box See github.com/jreznot/intellij-selenide-example 10
  8. Page Object Pattern — Main advantages: 1. Separate tests from

    page specific code 2. Single repository for operations offered by the page 11
  9. Kotlin for UI Testing — Most useful Kotlin features for

    UI testing: 1.Extension functions 2.DSLs: let{}, apply{}, with{} 3.Type inference and implicit casts 4.Null-safety 5.Data classes 6.String templates 12
  10. Reporting Libraries — Put your tests in order with reporting

    library: 1.Allure Framework 2.Serenity BDD 13
  11. Mobile Testing — You can still use Java for mobile

    testing with: 1.Appium 2.Selenide with Appium 14
  12. Running Selenium on CI Server — 1.Web browser on a

    host 2.Selenium Grid v3 or v4 3.Selenoid 4.Cloud Services 15
  13. Selenoid — 1. Enables you to run web browsers in

    Docker 2. Implements Selenium Hub protocol 3. Easy to install 4. Easy to share browsers setup with browsers.json config 16
  14. Running Test with Selenoid — Start Selenoid in Docker: https://hub.docker.com/u/selenoid

    > docker run -d \ --name selenoid \ -p 4444:4444 \ -v /var/run/docker.sock:/var/run/docker.sock \ -v /your/directory/config/:/etc/selenoid/:ro \ aerokube/selenoid:latest-release Selenide: Configuration.remote = "http://localhost:4444/wd/hub"; 17
  15. Selenoid UI — Provides status pages and VNC access to

    running web browsers under test. > docker run -d --name=selenoid-ui --link selenoid -p 8080:8080 aerokube/selenoid-ui --selenoid-uri http://selenoid:4444 18
  16. Perfect UI Automation Stack — ⬠ Java/Kotlin ⬠ Gradle ⬠

    Selenide ⬠ Allure Framework ⬠ Selenoid No more custom frameworks needed! 19
  17. Useful Resources — • Selenium Guides: www.selenium.dev/documentation • WebDriverManager: github.com/bonigarcia/webdrivermanager

    • Selenide: selenide.org • Allure Framework: github.com/allure-framework • Selenoid: aerokube.com/selenoid • Selenium UI Testing Plugin for IntelliJ IDEA: plugins.jetbrains.com/plugin/13691-selenium-ui-testing