Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview

In this tutorial, we will execute some tests using the Robot Framework. This tutorial explores the specific integration Xray provides for Robot Framework XML reports.

Requirements

  • robot frameworkRobot Framework
  • Selenium2Library
  • Java (if using the Java variant of the "robot framework")

Description

 


Next follows Below are several Robot test suites, each one containing several Robot test cases. 

...

The "CALC-1" and "CALC-2" tags above can be used to link the test case to existing requirement(s) or to an existing Test. When a requirement issue key is given, a link between test and requirement is created.

 


The previous Robot files make use of a common resource which contains some generic variables and some reusables reusable "keywords" (i.e., steps).

Code Block
titlelogin_tests/resource.robot
collapsetrue
*** Settings ***
Documentation     A resource file with reusable keywords and variables.
...
...               The system specific keywords created here form our own
...               domain specific language. They utilize keywords provided
...               by the imported Selenium2Library.
Library         BuiltIn
Library         Selenium2Library
*** Variables ***
${SERVER}         localhost:8080
${BROWSER}        chrome
${DELAY}          0.5
${VALID USER}       admin
${VALID PASSWORD}   admin
${LOGIN URL}      http://${SERVER}/login.jsp
${WELCOME URL}    http://${SERVER}/secure/Dashboard.jspa
*** Keywords ***
Open Browser To Login Page
    Open Browser    ${LOGIN URL}    ${BROWSER}
    Maximize Browser Window
    Set Selenium Speed    ${DELAY}
    Login Page Should Be Open
Login Page Should Be Open
    Title Should Be    Log in - Xray Demo Environment (JIRA 7)
Go To Login Page
    Go To    ${LOGIN URL}
    Run Keyword And Ignore Error        Get Alert Message
    Login Page Should Be Open
Input Username
    [Arguments]    ${username}
    Input Text    login-form-username    ${username}
Input Password
    [Arguments]    ${password}
    Input Text    login-form-password    ${password}
Submit Credentials
    Click Button    login-form-submit
Welcome Page Should Be Open
    Location Should Be    ${WELCOME URL}
    Title Should Be    Tests Dashboard - Xray Demo Environment (JIRA 7)

 


After running the tests (see bellow) and generating the Robot XML report (e.g., output.xml), it can be imported to Xray using via the REST API. 


If you're using Python,:

No Format
robot -d output .

 


Or if If you're using Java,:

No Format
java -jar robotframework-3.0.jar -d output  .

 


Each Robot's test case is mapped to a Generic Test in JIRAJira, having the summary with the name of the test case, and the "Generic Test Definition" field contains the concatenated names of the test suites along with the name of the test case. Note that Robot frameworks Framework considers the base folder of the project as the first test suite. The way you run your tests also affects Robot's XML; so, so if you execute the file from somewhere else or you execute directly the file directly by passing it as an argument, the test suites suite's information will potentially be potentialy different.

 

Image Removed

 


Image Added


You will Under the the Execution Details of the Generic Test, in the Context section it's possible to see information about each Robot keyword (i.e., step) , along with the respective status.

 

Image Removed

and its corresponding status in the Context section of the Execution Details of the Generic Test.


Image Added 


References