Mobile Apps are windows to user solutions in IT. the numbers of mobile apps are increasing due to demands for smartphone users. Hence there are increasing of the competition to deliver quality apps. Testing mobile apps are thus becoming a key process before rolling out app releases to users. Hence, mobile test automation is the need of the hour, to facilitate thorough testing of mobile apps efficiently and in less amount of time.
Robot framework is an open source test automation framework used for Acceptance-Test Driven Development (ATDD) implemented using python. It has an ecosystem which consists of various test libraries and tools that adhere to the keyword driven approach of robot framework. One of the external test libraries for mobile test automation is Appium Library which uses Appium to communicate with Android and iOS applications.
Key Features of Robot Framework:
- Business Keyword driven, tabular and easy to understand syntax for test case development
- Allows creation of reusable higher-level keywords from the existing keywords
- Support for standard and external libraries for test automation
- Tagging to categorize and select test cases to be executed
- Easy-to-read reports and logs in HTML format
- Allows creation of custom keywords
- Platform and application independence
Appium Library:
Appium is one of the External Library of robot framework for the mobile application testing which only supports Python 2.x. Here most of the capabilities of Appium are framed into keywords, which are easy to understand and help understand the purpose of the test case by reading the script. It uses Appium (version 1.x) to communicate with Android and iOS applications
Key Features of Appium:
- No recompilation or modification of app to be tested is required
- Tests can be written in any language using any framework
- Standard automation specification and API
- App source code is not needed
Robot – Appium Interaction:
Appium server, robot’s Pybot and Appium-Python Client play a significant role in this interaction.Test Suites consisting of test cases written using robot’s keyword driven approach are used to test the mobile application (Android/iOS).
Appium Server:
Appium is mainly responsible for the interaction between the app’s UI and robot’s appium library commands. It needs to be up and running to facilitate this interaction. Appium is an open source engine running on Node.js.
Appium-Python Client:
Appium-Python Client facilitates the interaction between appium library and appium server using JSON Wire Protocol. This client initiates a session with the appium server in ways specific to appium library, resulting in a POST /session request to the appium server, with a JSON object. The appium server then starts an automation session and responds with a session ID. This session ID is used in sending further commands to the server.
Pybot:
Pybot reads the different framework files from framework’s code base and executes the tests by interacting with Appium Library. On completion of test case/suite execution, pybot generates a report and log files with complete details of the test run.This is a robot framework module used to trigger the test scripts written in Robot framework format.
Test Reports and Logs:
Report and log files are created in the form of HTML documents after execution of the test suite. These files contain a detailed summary of the test case execution and all the necessary statistics related to the test case execution.
To conclude, the robot framework facilitates automation of test cases for mobile applications with a simple tabular syntax, which is easy to read and is platform independent without making changes in the source code of the application under test. The keyword-driven approach of robot framework always ensures the readability and re-usability of the test cases, thus making the automation framework robust and user-friendly.
Jenkins:
The leading open source automation server, Jenkins provides hundreds of plugins to support building, deploying and automating any project.
Jenkins is a continuous monitoring tool taking care of all the activities required to be run as part of complete automation end to end run. In the figure above, the role of Jenkins is to monitor the jobs that have been triggered to run the pybot tests.
Note: The Source Control Repository can also be used as Source for Jenkins Job to fetch the automation code repository.
The following image shows one of the Jenkins jobs, which triggers a test script file named
Launch_email_app.txt.
JENKINS: ROBOT PLUG-IN REPORT
Using the Robot Framework Plug-In for Jenkins is really a nice enhancement to present the Robot Framework results.
Jenkins has a plug-in for robot framework, which shows interactive reports. The user can drill down the reports to see details to analyze the health of the test cases running in consecutive job runs. The trend of every test case in every job running can also be analyzed with this plug-in.
To Conclude, the Robot Framework Jenkins Plug-In is a very decent addition to have a nicer visualization directly on the job result page. Furthermore, the report.html and log.html pages can be served by an external HTTP server to have direct access to them from the job page.