Integrate Robot Framework with Perfecto Smart Reporting

These days, many QA projects are using Robot Framework to build their automation test suites for Web and mobile device testing. Perfecto has released a library that enables Robot Framework scripts to better utilize Perfecto-extended commands and Perfecto Smart Reporting.

Important: This document includes references to a third-party product, Robot Framework. The user interface and usage of third-party products are subject to change without notice. For the latest published information about Robot Framework, see https://robotframework.org/robotframework/.

Prerequisites

Integrating Perfecto with Robot Framework requires the following PyPi packages.

Package name

Version

robotframework 2.6.0 or later
Appium-Python-Client 0.20 or later
selenium 2.47.1 or later
robotframework-appiumlibrary 1.3.7 or later
robotframework-seleniumlibrary 3.0.0 or later
robotframework-selenium2library 1.6.0 or later
six 1.11.0 or late

1 | Install Robotframework-PerfectoLibrary

To install Robotframework-PerfectoLibray, you can use your Python's pip module.

Installing PerfectoLibrary automatically installs the dependent packages to your computer. If you have not installed the robotframework-selenium2library package, it will install  version 3.0.0. Because this version has known compatibility issues with the legacy scripts, you need to downgrade this package to version 1.8.0. Therefore, make sure to run the following script as the last step in the procedure below:

Copy
python -m pip install robotframework-selenium2library==1.8.0

To install the Robotframework-PerfectoLibrary:

  1. Open a command line window.
  2. Run the following command:

    Copy
    python -m pip install perfectolibrary

    For Python 3, run:

    Copy
    python -m pip install perfectolibrary_py37

    The following image shows sample output.

  3. If needed, downgrade the robotframework-selenium2library package. See note above.

2 | Configure PerfectoLibrary

When PerfectoLibrary has been installed successfully on your machine, you can integrate it with your code. The easiest way is to include it into one of your most commonly used local script libraries, for example common_lib.robotYou can configure the following parameters to distinguish your script's reports in Perfecto

Copy
Library   PerfectoLibrary   ${Your_Project_Name}  |  ${Your_Project_Version}  |  ${Your_CI_Test_Job_Name}  |  ${Your_CI_Test_Job_ID}

where:

  • Your_Project_Name is the name of your project. This enables you to filter reports in Perfecto using the project name.
  • Your_Project_Version is the version of your project version. This enables you to filter report in Perfecto by project version.
  • Your_CI_Test_Job_Name: is the name of the CI test job if you have integrated your test scripts with Bamboo or Jenkins. This enables you to see your CI executions in Perfecto's CI Dashboard.
  • Your_CI_Test_Job_ID is the ID of your CI test job if you have integrated your test scripts with Bamboo or Jenkins. This enables you to view your executions by job ID and compare them with each other to see pass trends by execution.

If you do not specify any of these parameters, the following default values are used:

  • Your_Project_Name=Robotframework test Project
  • Your_Project_Version=1.0
  • Your_CI_Test_Job_Name=Robotframework test job
  • Your_CI_Test_Job_ID=1

3 |  View execution reports

When PerfectoLibrary is integrated with your scripts and configured properly, you can view execution reports in the Perfecto UI. In the CI Dashboard view, for example, you should now see your test job status by job ID, as shown in these sample images.

You can also view your executions by device type in heat map view:

Source code access

This library is open source and under the MIT License. Feel free to check out, fork, or modify the project at https://github.com/PerfectoMobileSA/Robotframework-PerfectoLibrary.