location_city Virtual Platform schedule Sep 11th 04:00 - 04:45 PM place Online Meeting 2 people 38 Interested

Selenium has become the de-facto standard framework for end-to-end web testing nowadays. JUnit 5 is the latest version of this popular testing framework and implements a brand-new programming and extension model named Jupiter. This talk presents Selenium-Jupiter (https://bonigarcia.github.io/selenium-jupiter/), an open-source JUnit 5 extension aimed to provide seamless integration with Selenium. At first glance, it allows creating Selenium tests using local or remote browsers, reducing the required boilerplate thanks to the dependency injection mechanism supported in JUnit 5. Moreover, it will enable us to use different types of web browsers and Android devices in Docker containers out of the box. All in all, Selenium-Jupiter can be used to carry out different types of tests for web and mobile applications, including functional, compatibility (using test templates to define different devices or browsers -types and versions-) or performance tests.

 
 

Outline/Structure of the Workshop

Table of Contents

  • JUnit 5, the next level of JUnit (10 minutes)
    • Motivation and architecture
    • Jupiter: Programming and extension model in JUnit 5
  • Selenium-Jupiter, JUnit 5 extension for Selenium (30 minutes)
    • Using local browser
    • Using remote browsers
    • Using browsers and Android devices in Docker
    • Test templates
    • Integration with Jenkins
  • Selenium-Jupiter beyond Java (5 minutes)
    • Command Line Interface (CLI)
    • Selenium Server

Examples

  • Hello World: JUnit 4 + Selenium WebDriver vs. JUnit5 + Selenium-Jupiter
  • Test using local browsers (e.g. Chrome, Firefox, Opera)
  • Test using options (e.g. headless Chrome)
  • Test using Appium
  • Test using browsers (e.g. Chrome, Firefox, Opera) in Docker containers
  • Test using Window browsers (e.g. Edge, Internet Explorer) in Docker containers
  • Test using Android devices (e.g. Samsung Galaxy S6, Nexus 4, Nexus 5, Nexus One, Nexus S, Nexus 7) in Docker containers
  • Recordings and remote access (with VNC) when using Docker
  • Performance tests using Docker
  • Test template example
  • Integration with Jenkins (access to screenshots and recordings using the Jenkins GUI)
  • Examples using Selenium-Jupiter as a CLI tool
  • Examples using Selenium-Jupiter as a Server (Node.js test as an example)

Learning Outcome

  • Main features of the programming and extension model of JUnit 5 (called Jupiter)
  • How to use Selenium from JUnit 5 tests for web and mobile (Android) testing
  • How Docker can be used to ease functional, compatibility, and performance tests
  • Integration with existing technologies, such as Appium, or Jenkins
  • How to use Selenium-Jupiter as CLI tool and a Selenium server

Target Audience

Developers/testers/CTOs

Prerequisites for Attendees

In this workshop, we will execute different examples to show the features of Selenium-Jupiter. These examples are located in the GitHub repository: https://github.com/bonigarcia/selenium-jupiter-examples.

It is highly recommended to run these examples to follow this workshop. To do that, attendees should bring a laptop with the following requirements in term of software:

  • Required:
    • Java 8+ (JDK)
    • Some IDE (Eclipse, IntellijIDEA, Visual Studio or NetBeans) or alternatively Maven or Gradle
  • Recommended:
    • Docker engine (in Linux, Mac, or Windows)
  • Optional:
    • Linux (required only to execute Android in Docker containers)
    • Jenkins (required only to execute the integration with Jenkins example)
    • Appium server (required only to execute the integration with Appium example)
    • Node.js (required only to execute the example using Selenium-Jupiter as a Server)
schedule Submitted 1 year ago

Public Feedback


    • Boni García
      keyboard_arrow_down

      Boni García - Diagnostic techniques for Selenium tests

      45 Mins
      Talk
      Beginner

      One of the main benefits of end-to-end tests with Selenium is the simulation of real user scenarios in an automated fashion. Nevertheless, end-to-end tests are often criticized because these kinds of tests do not isolate failures, and therefore troubleshooting failures can be difficult and costly for testers. This talk pretenses different techniques aimed to solve this problem. The objective is to provide useful assets to find the root cause of a failure in a Selenium test. The first one is screenshotting. Once a failure is detected, the state of the browser just before the failure happens can provide the clue to determine the nature of the problem. If the screenshot is not enough, the next step is to watch the browser during the test to observe the evolution of the web under test. This process is straightforward when running a test with the local browser, but it can be tricky in the usual case of running a test in a headless environment, such as Jenkins or Travis to name a few. The solution proposed is twofold. On the one hand, a Selenium session can be recorded using Virtual Frame Buffer (xvfb) and FFmpeg. On the other hand, we can use web browsers and mobile devices in Docker containers, in which the GUI session can be easily recorded using VNC and FFmpeg. The last mechanism proposed is the access to browser logs to debug the JavaScript traces of our applications. Unfortunately, the Selenium API only allows us to do it when Chrome is used as a browser. The solution proposed is to use monkey patching in the console object at JavaScript level in a cross-platform browser extension which is used to instrumentalize the browser (e.g., Firefox, Opera) controlled with Selenium WebDriver. All these mechanisms have been implemented in Selenium-Jupiter, a JUnit 5 extension for Selenium providing seamless integration with Docker. To ease the access to such information, Selenium-Jupiter provides seamless integration with Jenkins and Slack, publishing the resulting files (PNG screenshots, MP4 recordings, and TXT logs) in the Jenkins GUI or Slack channel when a test fails.

    • Boni García
      keyboard_arrow_down

      Boni García - Selenium tests with Docker and Kubernetes: to infinity and beyond

      45 Mins
      Talk
      Intermediate

      Docker is a container technology that has become pervasive in current software architecture and infrastructure nowadays. Kubernetes is a container orchestration platform, allowing large numbers of containers to work together. This presentation presents how Docker and Kubernetes can be used to create advance Selenium tests. The use of containers allows using different types of web browsers and Android devices in Docker containers out of the box, allowing to create functional or compatibility (using different devices and/or browsers types and versions) in an effortless manner. The use of a Kubernetes cluster allows to scale up the approach, allowing to a use huge number of browsers to develop performance or load tests with Selenium. All these mechanisms have been implemented in Selenium-Jupiter, a JUnit 5 extension for Selenium which provides seamless integration with Docker and Kubernetes.

      Moreover, Selenium-Jupiter can be executed as a Server which speaks the JSON wire protocol/W3C WebDriver, becoming into a Selenium Server. In this case, Selenium-Jupiter acts as a scalable hub (using the Selenium Grid jargon), providing browsers for any kind of Selenium script (Java, JavaScript, Python, etc.) using Docker and Kubernetes internally to allocate the requested browsers types (Chrome, Firefox, Opera, Explorer, Edge, and Android devices) and versions (stable, beta, dev).