Developing End-to-End Tests With Selenium 4 And Java: Boni García [Testμ 2022]

LambdaTest

Posted On: September 1, 2022

view count4985 Views

Read time6 Min Read

In this session of the Testμ Conference 2022, we had Boni García, Visiting Professor, Universidad Carlos III de Madrid, as our guest speaker who joined Sudhir Joshi, Head of Customer Success at LambdaTest, to take a deep dive into developing end-to-end tests with Selenium 4 and Java.

Boni spoke elaborately on build tools, unit testing framework, and a session library required to implement comprehensive Selenium WebDriver tests. He also discussed the tools for end-to-end testing.

What is Selenium

Boni starts this session by asking a question – What is Selenium? As per Boni, if we look at the documentation provided by Selenium, we see this motto – “What you do with that power is entirely up to you,” for which he informs his viewers that what you do with this power isn’t very up to you.

Selenium is....

He then asks the viewers to answer the question in simple words to make this session more engaging. Boni then quotes different definitions of Selenium to define it in simple terms. He also addresses multiple answers shared by the audience to what they think Selenium is.

What is Selenium?

Moving forward, Boni defines what Selenium is in his own words. As per him, Selenium is an open-source umbrella project that enables the automation of web browsers, and it is composed of three elements:

  • Selenium WebDriver, a library for controlling browsers. (e.g. – Chrome, Firefox, Edge, Safari or Opera) programmatically.
  • Selenium IDE is a tool (concretely, a browser plugin) that implements the Record and Playback (R&P) automation technique.
  • Selenium Grid is a networked infrastructure that provides remote browsers accessibility to the W3C Webdriver Protocol.

Boni then takes up the important question – What is NOT Selenium? As per him, Selenium is neither a testing framework nor a library. He then asks the session’s main question: Why do I need to do testing with Selenium?

Running Tests with Selenium

Boni talks about end-to-end tests as the first point to this question. He then mentions that we must first select a binding language for testing using Selenium. For this session, Boni selects Java as his choice of programming language.

binding language

Then Boni encourages us to choose an actual Unit testing framework since Selenium cannot be used as a testing framework. He recommends using JUnit, JUnit 5 or TestNG as the primary testing framework. Moving forward in the process, Boni chooses AssertJ as his assertion library as the provided assertions are very fluent.

Unit testing framework

He then recommends selecting one or a combination of browsers to be driven with Selenium. Boni suggests that as we progress in end-to-end testing, we will need something more advanced, like a remote environment for a browser such as Selenium Grid or Docker.

browsers

What is a Selenium Driver?

He then explains how a remote or a local driver works. According to Boni, a driver is a piece of software or a binary file that we need to put in the middle of the test using the Selenium window API. We need this software because Selenium WebDriver automates the browser using each browser’s native capabilities, offering a standard protocol to the test, the W3C Web Driver standard.

Boni then goes on to talk about the build tools. As per him, build tools are utilities used to automate the creation of software applications from their source code.

Selenium Driver

Along with this, he talks about choosing the right Selenium IDE. As per him, every IDE has its advantages, some of which are very advanced. Hence the process of selecting an IDE depends on your capabilities.

example of what a Selenium WebDriver with Java

Moving forward, Boni showcases an example of what a Selenium WebDriver with Java looks like with the elements he has explained so far. He showcases a sample test run using Selenium Grid and Docker.

Boni concludes the session with a few takeaways. They are:

  • Selenium WebDriver (often called simply Selenium) is a browser automation library, not a testing library.
  • We should use other testing frameworks and tools to perform end-to-end tests with Selenium.
  • When using Java, we can use JUnit/TestNG (Unit testing frameworks), Maven/Gradle (Build tools), and AssertJ (Assertion library), among others.
  • WebDriverManager and Selenium-Jupiter reduce the complexity of developing Selenium WebDriver tests by providing automated driver management and other features.

He further answered the questions put forth by the audience, where Sudhir Josi, Head of Customer Success at LambdaTest, took the initiative to ask them on the audience’s behalf.

It was indeed an informative session with Boni! The session ended with a few questions asked by the attendees to Boni. Here is the Q&A:

  • Does the WebDriver Manager work with Remote WebDriver?
  • Boni: Somehow, Selenium drivers can be used to support Selenium WebDriver by resolving the drivers required by the Selenium Grid. When you use a remote WebDriver, you don’t need to resolve the driver because it is supposed to be resolved along with the browser. That said, the WebDriver manager might help set up a Selenium Grid infrastructure.

  • Is implicit wait deprecated in Selenium 4?
  • No, it’s not deprecated. It’s still there. Although it’s not recommended to use implicit wait as it has different drawbacks. The implementation depends on the driver, so it’s still in Selenium for API, but it’s not recommended.

  • Can we expect JUnit built-in with Selenium?
  • I recommend using it together with Selenium. However, that will not result in something out of the box if that’s the question. You can use any framework as per your preference.

  • Which test reporting tool/library do you love to use while running end-to-end tests with Selenium?
  • There are different reporting tools that I recommend. I don’t usually use a testing report because the output generated by Maven or Gradle is enough for me. But for large projects, having a good dashboard is good, which can help the reporting framework. You can also check out the shared repository to see how you can use other frameworks.

After the successful Testμ Conference 2022, where thousands of testers, QA professionals, and developers worldwide joined together to discuss on future of testing.

Join the testing revolution at LambdaTest Testμ Conference 2023. Register now!” – The testing revolution is happening, and you don’t want to be left behind. Join us at LambdaTest Testμ Conference 2023 and learn how to stay ahead of the curve. Register now and be a part of the revolution.

TestMu Conf

Author Profile Author Profile Author Profile

Author’s Profile

LambdaTest

LambdaTest is a continuous quality testing cloud platform that helps developers and testers ship code faster.

Blogs: 149



linkedintwitter

Test Your Web Or Mobile Apps On 3000+ Browsers

Signup for free