Selecting an End to End Testing Framework - Selenium or Selenide?

Selecting an End to End Testing Framework - Selenium or Selenide?

SeleniumVsSelenide.png

Selenium or Selenide? Choosing UI automation framework is not an easy task. You have to consider many factors based on your company's needs:

  • Skillset available in the company
  • Learning curve
  • Ease of use
  • Cross-browser and platform support
  • Integration with cloud testing services
  • CI/CD integration
  • License cost
  • Detailed reports

Back then my fellow colleagues evaluated multiple frameworks and they narrowed down the choice to Selenium and Selenide. So the question is which framework to use?

I won't waste your time, so I quickly answer the question: both. Thanks for reading. 😊

Joking aside, if you are interested in the whys, please continue reading. In this first article let's look at both one by one so I can give a little bit more detailed answer to our question.

What is Selenium?

Selenium is an open-source project consisting of different tools for automating web browsers supporting many browsers across many platforms. It is widely used in test automation, but it is not limited only to testing. Its main components are Selenium WebDriver, Selenium RC, Selenium IDE (record and playback), and Selenium Grid. I won't talk about Selenium RC which is the predecessor of Selenium WebDriver, if you would like to read about it, you can find information here. I am also skipping Selenium IDE which is a simple record and playback tool. Based on my experience it is only useful for people who are beginners in software development or in case you are not that familiar with the DOM. In case you are still interested have a look at this page.

Selenium Webdriver

It is a collection of language-specific bindings to drive a browser natively, as a real user would do. The supported languages include Java, C#, Kotlin, Python, Ruby, JavaScript, Perl, and PHP. The WebDriver can run either locally or remotely (using Selenium Grid).

Selenium can only automate webpages but you cannot automate native apps, for that purpose you can use Appium. In case you are interested in Appium, I highly recommend Rahul Shetty's Udemy course.

In case you are interested in Selenium WebDriver programming using Java language, I highly recommend Rahul Shetty's course on Udemy, I personally learnt a lot from that. I also developed a Cucumber based Selenium framework following the course, so you can start Selenium development in no time with it. It is available on GitHub. For Selenide I cannot recommend a good course yet, but that is the main reason why I started to write this article series.

Selenium Grid

Using Selenium Grid you can run tests parallelly across multiple machines both virtual and physical ones. The latest version is Selenium Grid 4 which has a completely new codebase compared to its previous versions.

Using Grid you can build your own infrastructure, but there are many sites that provide Selenium grid services. One of them is Browserstackwhich supports more than 3000 real devices and browsers.

Selenide

Let's talk about Selenide. So what is Selenide? Selenide is an open-source framework built on top of Selenium WebDriver whose main purpose is to make test automation simple. As it is based on Selenium WebDriver it also means we get the full feature set of it and lets' see what else we get in addition:

  • It has a fluent API for tests, so you will have a more concise and readable code.
  • It supports Ajax, so you will have much less trouble with handling timeouts, so you can write more stable tests.
  • In addition to the Selenium selectors, you have more advanced selectors which make finding elements easy.
  • Provides easy ways to download files.
  • Provides methods to navigate between parent and child elements.
  • It is very easy to configure as it is using sensible defaults, so you don't have to mess with WebDriver, but of course, you can if you want.
  • Selenide automatically takes screenshots on failing tests providing also the link, even during running on Jenkins, so you can identify the problem more easily.
  • It has a built-in Profiler.
  • Sending keys to elements is quite slow using Selenium, as it is sending keys one by one. Selenide provides a javascript based method which is a much faster way to send keys.
  • Provides detailed error messages even logging the HTML source belonging to the element, so it makes debugging much easier.
  • Switching to Selenide from Selenium is easy, even if you have hundreds of Selenium tests, as the Selenium tests are completely compatible with Selenide.

That is the basic information we need about the frameworks, so let's continue with comparing them.

Evaluating the frameworks based on our requirements

Skillset available in the company

Our team has a strong Java background so Selenium seems to be a reasonable choice as it supports many programming languages including Java.

Selenide is limited to Java and other JVM based languages, but as we have the Java background Selenide is as good for us as Selenium. For us, the standing is Selenium:Selenide 1:1.

Learning curve

For Selenium, you can find tons of materials on the internet: video courses, tutorials, articles. In case you have a strong Java background and you are familiar with the DOM then learning Selenium is quite easy. As it is open-source you can also check the source code anytime.

Selenide has quite short documentation, but it has many examples available on GitHub. I have not found any video course on the topic, but of course, articles are available. Stackoverflow has a few hundred questions related to Selenide in comparison Selenium has almost 100000. Despite this, learning Selenide is also easy (especially in case you are already familiar with Selenium). It is also open-source, so you have the option to skim through the code if you want.

However many of the problems you encounter during Selenide development can be answered by the materials belonging to Selenium (as Selenide is based on Selenium WebDriver) it is still a win for Selenium: 2:1.

Ease of use

In case you look back at the Selenide introduction section you can see the list of topics in which Selenide excels in comparison to Selenium. This is a huge win for Selenide: 2:2.

Cross-browser and platform support

Both frameworks have the same browser and platform support. It is equal: 3:3.

Integration with cloud testing services

Both Selenium and Selenide can integrate with Browserstack, so it is equal again. The standing is 4:4.

CI/CD integration

Selenium integrates well with Jenkins and the same can be told about Selenide. At our company, we use GitLab which has its own CI/CD tool and I can tell Selenide works well with it: 5:5.

License cost

Both of them are free software: 6:6.

Detailed reports

Neither Selenium nor Selenide has built-in reporting, but you can easily integrate them with testing frameworks like JUnit or TestNg. With those frameworks, you can generate the needed reports. In addition to this Selenide has a profiler with which you can generate reports which include the execution time of every action in milliseconds. Based on this you can better understand where your tests are spending their time and where can you improve your tests. With the profiler, it is another point for Selenide.

Result

So the final result is 6:7 to Selenide. Of course, you cannot decide just on the result, as all of the factors have a different weight depending on your team's need. Taking into consideration the extra features of Selenide which makes development easier, we decided to go with it and we did not regret our decision. Selenide is quite an active project, having multiple releases per month, I highly recommend giving it a try.

Final words

This is the first introduction article of a series I will write about test automation using Selenide. I am pretty sure you are eager to see some code, so in the next article we will jumpstart Selenide development.

In case you are interested in the management side of quality assurance in an agile environment, then I recommend reading this article written by my colleagues Ákos Piltmann and István Szarka.

To close the article, I leave you a question here:

What is your number one UI automation framework? Please share your experiences in the comment section.

In case you do not want to miss my posts, just follow me here on Hashnode, on LinkedIn, on Twitter on Medium.com, on dev.to and even on Instagram. 😊

P.S.: Support me by sharing this article. 👍

📚Join the Selenide community on LinkedIn! ✌

Buy me a coffee!

Did you find this article valuable?

Support Miki Szeles by becoming a sponsor. Any amount is appreciated!