Libraries for test automation framework

Mukund Billa
5 min readSep 8, 2019

This article will describe the libraries required for developing the test automation framework in Java.

I am pretty sure that most of us don’t know the required libraries to get started during developing the automation framework. This article will help you to find all the required libraries that will make all of your automation framework needs. I have categorized the libraries based on their functional usage and can be added in your Gradle or Maven build file.

Here we go…..

Test Runners and Framework

Test runners are the tools/plugin/libraries that execute your test scripts. The below libraries can be used for organizing your test scripts and their execution flow.

  1. JUnit: JUnit is the first unit testing framework designed for java developers with the intention to perform the unit tests for their classes. This framework can be easily integrated with almost all JAVA supported IDE’s.

Maven Dependency: JUnit [4.12]

2. TestNG: An End 2 End test framework inspired from JUnit which supports data-driven framework(same test with different data set), retries(retry a failed test case automatically), a grouping of test cases, parallel execution, and lot more. This is the most used framework for developing the test automation scripts.

Maven Dependency: TestNG [7.0.0]

To install eclipse plugin it:

  • Click “Help -> Install New Software…” on top level menu
  • Paste the URL http://beust.com/eclipse to Work with: text field and press enter.
  • Select the plugins
  • Click “Next” button and accept the license to complete the installation.
  • Restart Eclipse

3. Cucumber: It’s a framework of choice for Business Analyst. This framework helps to collaborate all the stakeholders of AUT(Application under Test) and write the business use-cases in form of GIVEN-WHEN-THEN statements in natural language which are often called as BBD tests. This BDD tests can be executed using the above-defined test framework(JUnit and TestNG).

Maven Dependency: Cucumber [4.7.2]

Eclipse Plugin: Install

Selenium Drivers

Selenium is the most used framework for automating the web-based applications. The de facto tool selected for testing AUT in wide variety of browsers and writing the test scripts with the tester’s choice of language. It provides libraries for most of the web browsers and programming languages. It also support cloud testing with multiple cloud vendors which can be used to execute the test scripts directly on the cloud devices.

Selenium Core Libraries

  1. Selenium Java

Maven Dependency: selenium-java [3.14.0]

2. Selenium Core

Maven Dependency: selenium-api [3.14.0]

3. Selenium Server

Maven Dependency: selenium-server [3.14.0]

Web browsers driver libraries

  1. Chrome Driver

Maven Dependency: chrome-driver [3.14.0]

2. Firefox Driver

Maven Dependency: firefox-driver [3.14.0]

3. Safari Driver

Maven Dependency: safari-driver [3.14.0]

4. Internet Explorer Driver

Maven Dependency: ie-driver [3.14.0]

Mobile Driver

Appium is one of the open-source libraries available to test web/mobile-based application on mobile devices. This supports both Android and IOS and is built on top of selenium which makes it more powerful by abiding by the selenium webdriver specs. Appium thus is available to the tester to write test scripts with their preferred language. In order to start and use appium one may need a node.js as it is built on top of node server.

Appium needs Android SDK for testing android based apps. Android apps can be tested using windows/mac/linux OS however for testing IOS one may need MacOS OS. For IOS one may need Xcode for leveraging the IOS simulators and IOS SDKs.

Appium also has a desktop-based application that can be used to run the appium server directly without any need for running commands.

Maven Dependency: appium-java [7.2.0]

Test Data Readers

Test data for each test cases can be defined in different forms for e.g. excel based test data, json files, or yaml files. To read such different form of data we have to use different java libraries.

JSON Parsers:

jackson: A library which is mostly used for processing json data and marshal and unmarshalling the json to pojo.

Maven Dependency: jackson-core [2.9.9], jackson-binding [2.9.9]

gson: Another library to parse json data and its from google. It’s a light weight library to process and marshal/unmarshall from json to pojo.

Maven Dependency: gson [2.8.5]

Excel Readers:

apache-poi: A widely used library for reading MS-Office files and provides support for almost all office extension files. It’s been developed and maintained by Apache.

Maven Dependency: apache-poi [4.1.0], apache-poi-ooxml [4.1.0], apache-poi-ooxml-schemas [4.1.0]

Yaml Readers:

A yaml file is basically a json like file which is based on key-value pairs. Its a lightweight than json and xml.

snake-yml: A small library to parse yaml file.

Maven Dependency: snake-yaml [1.251]

API Testing Libraries

API Testing is a latest trending automation skills that every organization is looking for. It is used to test the API’s developed by the developers which are integrated with different applications. API Testing is faster and more reliable than GUI testing. One must automate most of their test cases at API Testing layer instead at GUI layer. This not only focuses on functional part but also remove the dependency of UI changes.

rest-assured: A library that winning the heart of every automation tester. It provides all the necessary classes which are needed to perform the API test. We can inject cookies, have an authorized header.

Maven Dependency: rest-assured [4.1.1]

Mock Libraries

Mock libraries are useful for developing the automation for API test cases which are under development. The mock libraries help you to develop the static APIs for testing purpose which can be generated on the fly within your test scripts. This is specifically useful for micro-services which are about to be developed. One of my favourites mock library are below

Mock Server: MockServer can be used for mocking any system you integrate with via HTTP or HTTPS (i.e. services, web sites, etc). When MockServer receives a requests it matches the request against active expectations that have been configured. An expectation defines the action that is taken, for example, a response could be returned.

Maven Dependency: mockserver-netty [5.6.1], mockserver-java-client [5.6.1]

Test Reporters

Reporting is one of the primary requirements for any test automation framework. The report is the outcome which provides the statistics to all the stakeholders of the AUT. The test report must be comprehensive as well as must be detailed with every log for each test case that can be used to perform analysis if it gets failed. Below are the most used framework/libraries that can be integrated into automation framework.

ReportNG: This is used as a replacement of default test report generated from TestNG execution. ReportNG provides a simple, color-coded view of the test results. ReportNG generates 100% valid XHTML 1.0 files. The output can be customized by overriding the default stylesheet with your own CSS file.

Maven Dependency: report-ng [1.1.4]

Extent Reports: Another open-source library for integrating report generation. An extensive library provided to use in the test scripts to log the test results in a simplest form.

Maven Dependency: extent reports [4.09]

Allure Reports: A open-source library for generating the report. It has a multiple libraries that one can use to integrate as per their own test framworks. The below dependency is for TestNG framework.

Maven Dependency: allure-testng [2.12.1]

Image Credits: Toptal

--

--

Mukund Billa
Mukund Billa

No responses yet