Integrating Robot Framework Test Results with PractiTest

If you’re utilizing Robot Framework for test automation, you can seamlessly integrate your test results with PractiTest test management platform. By uploading your test results XML file to PractiTest’s FireCracker tool, you can effortlessly import your automation test results into PractiTest to keep track and gain better insights into your automation efforts.

Creating Tests with Robot Framework

After installing Robot Framework and the relevant libraries, you can create your tests. You can either run tests in a single test suite or create multiple test suites. In this example, we create two tests in two different test suites while using the SeleniumLibrary to interact with a web browser and test login functionality.

Example Test Suite for PractiTest Login Functionality
*** Settings ***
Documentation    A suite to test the login functionality of PractiTest website.
Library          SeleniumLibrary

*** Variables ***
${Login-URL}     https://www.practitest.com/
${BROWSER}       Chrome
${USERNAME}      user
${PASSWORD}      password

*** Test Cases ***
Valid Login
    Open Browser to Login Page
    Type in the Username Field    ${USERNAME}
    Type in the Password Field    ${PASSWORD}
    Click Login Button
    You Are Taken to Your Project’s Main Page
    [Teardown]    Close Browser

*** Keywords ***
Open Browser to Login Page
    Open Browser    ${Login-URL}    ${BROWSER}

Type in the Username Field
    [Arguments]    ${username}
    Input Text    id=username_field    ${USERNAME}

Type in the Password Field
    [Arguments]    ${password}
    Input Text    id=password_field   ${PASSWORD}

Click Login Button
    Click Button    id=login_button
Example Test Suite for PractiTest Login Functionality
*** Settings ***
Documentation    A suite to test the navigation functionality of PractiTest website.
Library          SeleniumLibrary

*** Variables ***
${Base-URL}     https://www.practitest.com/
${BROWSER}      Chrome

*** Test Cases ***
Navigate to Product Page
    Open Browser to Home Page
    Click Product Link
    You Are Taken to the Product Page
    [Teardown]    Close Browser

*** Keywords ***
Open Browser to Home Page
    Open Browser    ${Base-URL}    ${BROWSER}

Click Product Link
    Click Link    xpath=//a[@href='/Product]

You Are Taken to the Product Page
    Wait Until Page Contains Element    xpath=//h1[contains(text(), 'REDEFINING POSSIBILITIES IN TESTING')]    10s
    Element Should Be Visible    xpath=//h1[contains(text(), 'REDEFINING POSSIBILITIES IN TESTING')]

Executing Tests and Generating an xUnit-XML Report with Robot Framework

Robot Framework can generate an xUnit-XML report, which you can then upload to PractiTest using the FireCracker tool. Execute your test suites using the robot command with the –xunit option to generate an xUnit XML report.

robot --xunit xunit_output.xml login_test_suite.robot navigation_test_suite.robot

Once the test execution is complete Robot Framework will generate an xUnit-XML report.

Example xUnit-XML Output
?xml version="1.0" encoding="UTF-8"?>
<testsuite name="Login Test Suite" tests="1" errors="0" failures="0" skipped="0" time="25.000" timestamp="2024-05-30T12:30:17.167325">
     <testcase classname="Login Test Suite" name="Valid Login" time="25.000">
       </testcase>
     <properties>
       <property name="Documentation" value="A suite to test the login functionality of PractiTest website."/>
       </properties>
     </testsuite>
   </testsuite>
 <testsuite name="Navigation Test Suite" tests="1" errors="0" failures="0" skipped="0" time="20.00" timestamp="2024-05-30T12:45:18.964524">
     <testcase classname="Navigation Test Suite" name="Navigate to Product Page" time="20.00">
       </testcase>
     <properties>
       <property name="Documentation" value="A suite to test the navigation functionality of PractiTest website."/>
       </properties>
     </testsuite>
   </testsuite>
 </testsuite>

Uploading Robot Framework Test Results to PractiTest

Once the XML report is generated by Robot Framework, you can upload your test results to PractiTest via FireCracker. To better understand how to work with FireCracker, please refer to this help page and watch this tutorial: