Our documentation site has been updated to AIO Tests Knowledge Base

Robot Framework [Python]

AIO Tests supports importing Robot results through it’s support for JUnit reports. Robot Framework, an open source automation framework, is a widely popular framework.  It uses the keyword-driven testing technique approach and testcases are written in a tabular format. Several output files are created when tests are executed in Robot, one of them is an xUnit compatible report.

The JUnit xml file can then be imported into AIO Tests, to report results from Robot runs to AIO Tests. This document provides an overview on how you can generate the Junit report from Robot runs and upload it to AIO Tests. The demo example is based on SeleniumLibrary, which is a web testing library for Robot Framework that utilizes the Selenium Webdriver tool internally

 

Required Robot + Webdriver Setup

  1. pip install robotframework

  2. pip install --upgrade robotframework-seleniumlibrary

  3. Install the browser driver and set it in PATH OR pip install webdrivermanager

Mapping Cases with AIO Tests

The below is just a sample test file, which opens the google and queries for a topic.

AIO Tests supports creating tests using the reports as well as mapping existing cases.

Mapping existing AIO Tests to automated Robot Tests

AIO Tests generates a unique key for each test created in AIO Test, example SCRUM-TC-1. To map an automated case to an existing AIO Test, the test name can take the testcase key generated in its description. e.g.AT-TC-299 : Login with existing user

In the example below, one existing AIO Test has been mapped to a Robot test

*** Settings *** Documentation Simple AIO Test Integration example using SeleniumLibrary. Library SeleniumLibrary *** Variables *** ${LOGIN URL} https://yourcompany.atlassian.net ${BROWSER} Chrome ${VALID USERNAME} yourusername ${VALID PASSWORD} yourpassword ${INVALID USERNAME} nothing@noasdf.com *** Test Cases *** AT-TC-299 Login with existing user Open Browser To Jira Login Page Input Text id:username ${VALID USERNAME} Click Button id:login-submit Wait Until Element is Visible id:password Input Password id:password ${VALID PASSWORD} [Teardown] Close Browser Login with user not existing Open Browser To Jira Login Page Input Text id:username ${INVALID USERNAME} Click Button id:login-submit Wait Until Element is Visible id:displayName1 [Teardown] Close Browser *** Keywords *** Open Browser To Jira Login Page Open Browser ${LOGIN URL} ${BROWSER}

 

This would pull AT-TC-299 in the execution cycle and mark the result AT-TC-299 as passed i.e.”Login with existing user” against AT-TC-299

Creating new cases in AIO Tests from automated Robot Tests

If no new key is specified in the spec, then new cases can be created using the results of the tests.

In the above code example, the second test has no key mapped and hence this would create a new test in AIO Tests.

While importing results, if the Create New Case selection is true, then AIO Tests will use the classname.methodname e.g. in the above case, from the Junit results file as a unique automation key to identify the test to AIO Tests.

In the above example, second test would be created with Test1.Login with user not existing.

AIO Tests key would still be generated of the format SCRUM-TC-xyz, which can then be added to the test name. This would ensure that changes to the description do not end up creating cases where new cases were not intended.

Configuration and Running ROBOT tests with Junit option

Since Robot has added native support for JUnit, no new dependencies need to be added to generate the JUnit report. Tests can be triggered as below with the -x option and the name, that you would like for your results file

robot -x junitresult.xml tests/test1.robot

Sample report file

The spec file runs and generates a test-output file under the results folder. A sample JUnit results file looks like below:

<?xml version="1.0" encoding="UTF-8"?> <testsuite tests="2" errors="0" name="Test1" skipped="0" time="16.137" failures="1"> <testcase classname="Test1" name="AT-TC-299 Login with existing user" time="5.228"> </testcase> <testcase classname="Test1" name="Login with user not existing" time="10.713"> <failure message="Element 'id:displayName1' not visible after 5 seconds." type="AssertionError"></failure> </testcase> </testsuite>

Importing Results

Post execution of a JUnit suite, the TEST-<xxx>.xml file can be uploaded either via

Please follow the above links to continue to import results using either of the options.

Importing the above file will mark AT-TC-299 as Passed in the cycle.

A new case would be created with title Login with user not existing and added to the cycle with a result of Failed.