Putting Down the Coffee: Using Test Automation Without Java

  • 25 March 2021
  • 0 replies

Badge +1

In the corporate software world, Java is something of a lingua franca. I’d wager that most large companies that have large codebases have at least some of their code written in Java. In many enterprise organizations, it’s the go-to language. This also tends to the be case with large Selenium-based test projects in many firms.

Java has several advantages, particularly for large-scale projects, such as excellent packaging for importing and exporting portions of a codebase and mature well-developed tooling. But Java is also a verbose language, and establishing a new project in Java can be cumbersome, particularly for novice developers. Java can also be, frankly, not very fun to work with. My standard opinion about the Java programming language is as follows: I love my family. I love my cats. I don’t love Java.

The Selenium community supports Java bindings of the WebDriver client and the Selenium server is written in Java, which makes Java seem like a natural choice of language for many projects. There are four other language bindings for the WebDriver API that the Selenium project supports, however. These are Ruby, Python, C# and Javascript. Each of these languages and bindings have their own advantages that could make them an ideal fit for many browser test automation projects.

In no particular order, here are some reasons you should consider using each of these languages instead of Java.

Ruby: Ruby is the sleeper hit of Selenium test automation. Not only is Ruby a flexible, concise language but there’s also good tools that have been built on top of Selenium specifically for browser test automation. Capybara is a test framework that is included with Ruby on Rails, the popular BDD framework Cucumber has a large Ruby following, and there’s the excellent Watir library, which pre-dates the Selenium WebDriver. Most of all, there is an excellent community that has developed around test automation using Ruby. This community is highly active and constantly improving approaches and collaborating to make tooling even better. I would highly recommend any team starting from scratch with a choice of language stack to look into Ruby.

Python: Python is a lovely language to write code in. Due to syntax, all Python code looks very similar. It’s also cross-platform, working effectively on Linux, Mac and Windows OSs. Test tooling in Python is straightforward to use with the low-overhead of the PyTest framework. Python also has great related libraries for handing HTTP requests called requests and parsing HTML/XML called Beautiful Soup which can be extremely helpful for test frameworks that need to include testing beyond browser test automation. Python is fantastic for scripting small one-off tasks but can also scale up to meet the the demands of larger projects such as enterprise test frameworks.

C#: In some ways, C# is the better Java. From a language standpoint, it has a similar feel to Java being mostly class object oriented but with less strictness over file conventions. C# is also a first-class member of the .NET ecosystem which can provide two major benefits on Windows OSs. The first major benefit is Visual Studio, Microsoft’s flagship IDE and one of the best developer environments around. Visual Studio seamlessly combines many developer tools together, from test runners to performance profilers to source control systems. The second benefit is that .NET on Windows can integrate well with other OS level tools such as COM interfaces for desktop applications or MS SQL Server for database integrations. If you are testing applications built primarily for Windows, C# can offer quite a bit of value.

Javascript: NodeJS is the new hotness and people are flocking to it. Server-side Javascript is exciting because many front-end developers are familiar with Javascript and now have the opportunity to write full-stack applications. As well, the rise of front-end frameworks such as Angular, React, and Vuejs has become the basis for getting into Node for other aspects of software development. Along with this interest have come a flurry of libraries and tools for using WebDriver with NodeJS, including the original WebDriver JS bindings, the increasingly popular WebdriverIO project, Jest, and all kinds of related modules for integrating these with other tooling in the NodeJS ecosystem. If you want libraries and tooling that are fresh and new with growing interest, Javascript via NodeJS is something to definitely look into.

Before you reach for Eclipse, think about the above options and what else you can use for your test automation project that suit your needs and desires.

0 replies

Be the first to reply!