Unified Approach Towards Automation of Any Desktop Web Mobile Web Android iOS REST and SOAP API Use Cases
Unified Approach Towards Automation of Any Desktop Web Mobile Web Android iOS REST and SOAP API Use Cases
Abstract—In today’s world, testing cannot be efficient suite against different channels (i.e., desktop web, mobile
without automation. We need automation for avoiding web and native mobile application) with minimal changes.
repetitive work, making sure that the time from development
to deployment is reduced with good quality. We just don’t need II. LITERATURE SURVEY
automation tests, rather tests which are reliable, robust, easy to
code, debug, scale and can run in parallel on distributed A. Karate
environment. Karate[1] is a java library for testing web services -
SOAP and REST. Karate library is written on top of
The paper explores the challenges that can be faced while Cucumber- JVM. It is an open-source project that provides
automating web, mobile web, android, ios, api tests via a libraries for web api testing, mock and performance testing.
common framework such as, a common way of interaction Karate also provides a standalone executable for teams that
with web and mobile apps, automatically identifying connected are using Non-Java programming languages, to write
mobile devices and run the parallel test instances, writing programming language neutral testing code to deal with
hybrid tests; a combination of web and api use cases, not XML, HTTP or JSON. Some of the important features of
tightly coupled with a specific application rather can be used
Karate.
for automating any web, mobile based application.
• DSL support with support for XML and JSON
This paper further discusses the approach to bring
efficient, generic and re-usable solution for these challenges • Tests are very readable
while ensuring that the users write reliable, robust and
effective tests. The approach followed here spans across • Embedded UI for debugging and re-play steps while
following areas:- Webdriver management and parallel run. editing
DSL layer on top of the existing api libraries for easy to use • Built-in support for switching between multiple
interface. Reporting and logging mechanism. Utilities and
environments
integration with third parties (like Slack, Jira, Bitbucket,
Jenkins, Device Farms, etc ) • Pluggable HTTP client abstraction to support
Apache and Jersey
The benefit of this framework is, it is application agnostic
capability, which helps to use the same framework against any • Built-in test reports powered by Cucumber JVM with
web applications (web,mobile) for test automation. the option of choosing any third-party reporting tools
Keywords—api, rest, soap, webservice, automation, mobile, • Mock server for API calls that maintains CRUD
web, ios, android. across multiple calls
Authorized licensed use limited to: JADAVPUR UNIVERSITY. Downloaded on August 14,2023 at 10:13:59 UTC from IEEE Xplore. Restrictions apply.
Configuration management in the proposed framework methods, the commonly faced reasons of tests being flaky
hap- pens using properties file. JVM argument takes the are handled and thereby the consumer of the framework can
highest precedence, followed by the project specific be rest assured that the test failure is not because of test
config.properties, which is expected to be present in the being flaky but because of an issue in the application.
classpath of the project. If the given property is neither
present in JVM arguments not in the config.properties, it Mostly common reasons being,
falls back to default.properties bundled in the framework. • Stale element references.
Switching between environments is supported.
• Dynamic loading of content using AJAX calls.
Our proposed framework broadly contains 2 layers: (1)
Test Runner layer (2) Utilities layer • Trying to operate on element before the element is
enabled or available to be operated.
A. Test Runner layer
All the above scenarios are handled as part of the interface
Test Runner layer packs the interfaces for the test intents
provided by the framework with which the test intends
to interact with the framework and API calls or interacting
interact with. When test intends interact with the interface
with WebDriver incase of UI tests.
all the reasons of test being flaky and providing false
1) API Testing: Test Runner exposes RestClient positive test results are handled and this provisioning
interface for API testing, which has pluggable enables the consumers of the framework to just adhere to
implementation. Our current implementation is using the task of writing the test intent and rest all are taken care
UniRest[13] for making REST API calls and SOAP web by the framework out of the box. Configuration
service calls over HTTP. UniRest, even though it is a management of UI tests is simple and almost any behaviour
lightweight HTTP client, yet powerful and supports can be overridden at individual project level, like the wait
seamless parallel execution and asynchrony out of the box. timeouts, capability of webdriver - saving downloaded file
All test intents interact with the interface directly and to the location, position and dimension of the browser
underlying implementation will never be known to the window, etc.,
consumers of the framework. Even in future, if there is a
Alongside the above capabilities, listeners are integrated
need to switch to any other HTTP library, the test intents
with the framework to enable taking screenshots of
need to make absolutely no change and can be ported easily
webdriver instance and highlighting the point of failure.
to the new library as long as it adheres to the interface
Incase of tests run real devices, capturing the device logs for
having abstract methods to make different HTTP calls like
the application, performance stats, etc., and for web
GET, POST, PUT, DELETE, etc., Our proposed framework
browsers, capturing browser and network logs are also
provides a clean DSL builder pattern to build the request
provisioned. Thus allowing the consumers of the framework
with headers, request parameters, path parameters, request
to directly analyze the reason of failure of the testcase
body. Request body can be a simple JSON String, XML
directly from the allure reports, instead of digging deep in
String or it could be a Plain Old Java Object (POJO) also.
the logs.
This conversion of Plain Old Java Object to appropriate
String - JSON or XML happens based on Content-Type The proposed framework also provisioned with capability to
header that is passed along with the request. Our proposed maintain locators of web elements in a structured way for
framework supports with different utility methods for easy usage. The framework encourages Page Object
conversion of response to Plain Old Java Object and vice- Model[16] pattern for UI tests for having well-structured
versa, saving response to file, parsing and extracting data and reusable components of the application. Thus
from complex XML or JSON response, etc., makes handling externalizing the invariable and variable locators to be
with response very easy. Writing any utility methods will be modified without making change in the Page Objects. This
super simple as it can be used in JVM language. feature is exposed using AbstractBasePage object to allow
consumers to directly make use of the locators capability
2) UI Testing: UI testing uses standard libraries like
with the wrapped webdriver utilities.
Selenium[14] for desktop web and appium[15] for mobile
testing. Based on which channel - namely desktop web, Parallel execution of API tests is controlled using TestNG
mobile web, android app, ios app, the corresponding configuration of providing thread count, which can also be
WebDriver is created. With the feature of emulating mobile overridden by the framework to have a better control. Incase
browser on desktop chrome browser, the framework also of UI tests, again the parallelism is controlled using TestNG
allows to run mobile web tests on desktop chrome browser configuration when it comes to running tests for desktop
as mobile browser. This is driven through configuration web and emulated mobile chrome. When it comes to
whether to use real device or emulated chrome browser, and running tests on real devices from local machine,
also which device need to be emulated - Google Pixel 2, parallelism is controlled based on number of devices
iPhone 8, etc., The proposed framework also allows to use connected to local machine. When using any external device
custom phone dimensions and pixel ratio. For testing mobile farms, depends on the subscription. Parallelism at both test
apps and mobile web on real device, the proposed class and method level supported by the framework.
framework starts the appium session through code and the
device to be run on is identified using Android Debug B. Utilities layer
Bridge (ADB) commands in case of Android and idevice id All the test intends and helper classes interact with the
or xcrun command in case of iOS real devices and simulator Utility layer to perform various utility operations.
connected to the local machine respectively. This works
only on local machines. Connecting to external device farms
like BrowserStack, SauceLabs, Amazon Device Farm, etc.,
is also provisioned the framework configuration.
Framework also exposes utility class containing methods to
interact with the WebDriver. In these utility classes and
Authorized licensed use limited to: JADAVPUR UNIVERSITY. Downloaded on August 14,2023 at 10:13:59 UTC from IEEE Xplore. Restrictions apply.
and Excel utilities. All these utilities are implemented using
open-source libraries.
Authorized licensed use limited to: JADAVPUR UNIVERSITY. Downloaded on August 14,2023 at 10:13:59 UTC from IEEE Xplore. Restrictions apply.
18. Log4j 2.x. [Online]. Available: https://logging.apache.org/log4j/2.x/
Proposed
S.No. Features Selenide Katalon 19. Logback. [Online]. Available: https://logback.qos.ch/
System
20. Spring jdbc. [Online]. Available:
Build-In support for https://docs.spring.io/spring/docs/4.0.x/spring-framework-
10 No Yes Yes
reporting reference/html/jdbc.html
21. Hikari cp. [Online]. Available:
11 Built-In support for logging No Yes Yes
https://brettwooldridge.github.io/HikariCP
22. Allure. [Online]. Available: https://docs.qameta.io/allure/
12 No Yes No
Automated video recording
V. CONCLUSION
Each of the existing system provides a good support
either for API, Web or Mobile Application. But the
proposed system is the best for a combination of all. The
proposed system has a flexible configuration management
allowing the users to take advantage of features provided by
the system at their convenience. It is backed with an inbuilt
support for reporting and logging making debugging and
analysis simple. It allows users to write tests with absolutely
no change for different channels. The tests automated using
the proposed system can be run anywhere. The proposed
system uses only open-source libraries. These library
features are wrapped around the interface, thus giving the
framework the flexibility to switch to any other library that
comes up in the market with better features without
affecting the tests that are automated using the proposed
system.
REFERENCES
Authorized licensed use limited to: JADAVPUR UNIVERSITY. Downloaded on August 14,2023 at 10:13:59 UTC from IEEE Xplore. Restrictions apply.