logo logo

Robot KDT Reports You Love Are Now in The Cloud!

main post image

We are very excited to announce that starting from today, you can work on your Robot Framework tests you love straight from TestProject‘s platform! πŸ€– If you are a true fan of Robot, KDT, Python and Selenium you can finally have your Robot KDT repots on TestProject’s cloud dashboard, with just one simple line πŸ˜‰

pip3 install testproject-robot-library

Table of Contents: TestProject πŸ’— Robot Framework

  1. Why use the TestProject Library for Robot Framework?
  2. Prerequisites
  3. What is Robot Framework
  4. Create a New Test using the TestProject Library for Robot Framework
  5. New Test Suite Using the TestProject Library for Robot
  6. Robot KDT Reports you love are now in the cloud
  7. Watch live demo recording! ✨

Why use the TestProject Library For Robot Framework?

TestProject offers a set of tools for creating end-to-end tests:

  1. TestProject Agent handles the deployment and configuration of Selenium/Appium.
  2. Keeps you up to date with the latest stable versions of Selenium/Appium drivers.
  3. Cloud team collaboration and automatic test reports (HTML/PDF/JSON).
  4. Codeless test recorder allows creating and running tests without a single line of code.
  5. Code extract feature, which allows you to generate Selenium/Appium code from your codeless tests.
  6. Coming soon: Automatic deployment of your Robot tests across multiple targets by TestProject Agent (complete CI/CD experience).

By integrating this library with your Robot Framework tests, you can enjoy all these advantages, as well as fully automated Robot KDT reports (with screenshots) hosted for free on the TestProject platform.

Combining the TestProject Library with Robot Framework is as simple as using the SeleniumLibrary. It’s implementing the same syntax, replacing only the “Open Browser” keyword.

Prerequisites

Before getting starting, just make sure to complete the following:

  1. Login or create a new free TestProject Account.
  2. Download and Install the TestProject Agent.
  3. Register the Agent, and get your developer token from here.
  4. Install the Robot Framework: pip3 install robotframework, or following the installation instructions here.
  5. Install the TestProject Library for Robot: pip3 install testproject-robot-library.

What is Robot Framework

Robot Framework is a generic open source automation framework. It can be used for test automation and robotic process automation (RPA).

  • Robot Framework has easy syntax, utilizing human-readable keywords.
  • Its capabilities can be extended by libraries implemented with Python or Java.
  • The framework has a rich ecosystem around it, consisting of libraries and tools that are developed as separate projects.

You can read more on Robot Framework in the following blogs & tutorials:

  1. Robot Framework Introduction – Simplify your Test Automation Process
  2. Top 8 Python Testing Frameworks in 2020
  3. Robot Framework: Tips for Writing Automated Test Cases
  4. Create a Test Automation Environment with Appium, Robot Framework & Jenkins

Create a New Test using the TestProject Library for Robot

The first thing we need to do is create a new Robot test file. Let’s call this file MyRobotTest.robot. Since we’re going to use the TestProject Library for Robot, we must declare it inside the test:

*** Settings ***
Library TestProjectLibrary

Once the TestProject Library for Robot is declared, we can use its full functionality.

Next up, let’s create a Suite Setup section for initializing the TestProject Driver:

Suite Setup InitTestProject

*** Keywords ***
InitTestProject
    Init Testproject Driver     chrome      timeout=5000    job_name=TestProjectRobot
    Open Browser https://example.testproject.io/web/

In this snippet, we declare a custom Keyword named InitTestProject which creates a new session with the TestProject Agent, requesting to open a Selenium session on a Chrome browser.

πŸ’‘ Under the *** Keywords *** section we can put all of our custom keywords.

Init TestProject Driver is the most important part of the TestProject Library for Robot. It communicates with the TestProject Agent and passes any Desired capabilities, browser type, timeouts and additional data that is required by the TestProject Agent.

πŸ’‘ This method replaces the Create Webdriver and Open Browser keywords, and is the only difference between the SeleniumLibrary and the TestProject Library for Robot.

Since the TestProject Library for Robot was created as a wrapper for the SeleniumLibrary, you can simply take your existing Robot tests, replace the import of the SeleniumLibrary with TestProjectLibrary, call the Init TestProject Driver keyword and you are good to go! πŸ’ͺ

The following Selenium test:

Library SeleniumLibrary

Open Browser browser=Chrome url=https://example.testproject.io/web/
Create Webdriver driver_name=Chrome

Changes to:

Library TestProjectLibrary

Init Testproject Driver browser=Chrome url=https://example.testproject.io/web/

That’s it! 🀩

New Test Suite Using the TestProject Library for Robot

In this section, we will create a simple test suite with 4 tests:

  1. Login with an incorrect password
  2. Login with a correct password
  3. Filling in a form with some details
  4. Submitting the form

The suite is built to run on TestProject’s example website: https://example.testproject.io/web.

Here is the complete Robot test:

*** Settings ***
Library     	TestProjectLibrary
Suite Setup     Init Session
Suite Teardown  Close Session

*** Test Cases ***
Set Session
    ${previous kw}=     Register Keyword To Run On Failure      None
Login With Incorrect Password
    Base Login          ${INCORRECT_PASSWORD}
Login With Correct Password
    Base Login          ${CORRECT_PASSWORD}
Fill Form
    Select From List By Label   css:#country    Australia
    FOR     ${input}    IN      @{INPUT_ELEMENTS}
        Input Text      ${input}    ${INPUT_VALUES}[${INDEX}]
        ${INDEX}=       Evaluate    ${INDEX} + 1
    END
    Static Sleep
Submit Form
    Click Button    css:#save
    Click Button    css:#logout

*** Keywords ***
Init Session
    ${options}=                 Headless Chrome
    Init Testproject Driver     chrome    timeout=5000      job_name=TestProject Robot  url=https://example.testproject.io/web/     desired_capabilities=${options}

Close Session
    Close All Browsers

Equals
    [Arguments]                     ${x}    ${y}
    Should Be Equal As Strings      ${x}    ${y}

Clear Fields
    Clear Element Text     css:#name
    Clear Element Text     css:#password

Headless Chrome
    ${chrome_options} =     Evaluate    sys.modules['selenium.webdriver'].ChromeOptions()    sys, selenium.webdriver
    Call Method    ${chrome_options}    add_argument    headless
    Call Method    ${chrome_options}    add_argument    disable-gpu
    [Return]       ${chrome_options}

Base Login
    [Arguments]               ${input_password}
    Press Keys                css:#name                       ${EMAIL}
    Input Text                css:#password                   ${input_password}
    ${password}=              Get Value                       css:#password
    ${result}=                Run Keyword And Return Status   Equals    ${password}    ${CORRECT_PASSWORD}
    Run Keyword If            "${result}" == "True"           Run Keywords True
    ...     ELSE              Clear Fields

Run Keywords True
    Click Button      css:#login
    Sleep             3s

Static Sleep
    Sleep             3s


*** Variables ***
${EMAIL}                [email protected]
${INCORRECT_PASSWORD}   67890
${CORRECT_PASSWORD}     12345
${INDEX}                0
${CAPABILITIES}         ${EMPTY.join(${_tmp})}
@{INPUT_ELEMENTS}       css:#address    css:#email    css:#phone
@{INPUT_VALUES}         Melbourne       [email protected]  7521234545
@{_tmp}
    ...  browserName: chrome,
    ...  version: 86,
    ...  name: RobotFramework Test

Visit our GitHub repository to learn more about this exciting new TestProject Library for Robot Framework ✨

Robot KDT Reports in the TestProject Cloud

Now, the Robot KDT reports in the cloud you’ve all been waiting for! β›…πŸ“Š Once you complete the local execution of your tests using the TestProject library for Robot, you will automatically receive your Robot KDT reports and screenshots directly in the TestProject reporting dashboard.

Below is an example of how the test reports look like. You can also download the test reports into a detailed PDF file! This is an example you can download directly from here to see for yourself!

Robot KDT reports in the Cloud - TestProject Robot Framework

For those of you who prefer watching tutorials – You should definitely watch this awesome webinar recordings presented by Ran Tzur and Antti Karjalainen ✨

πŸ‘‰ Get the Presentation Slides πŸ‘ˆ

All of the Robot fans out there – Now’s the time to start exploring these awesome cloud KDT reports!
Share your thoughts in the comments below
πŸ€–πŸ’—πŸ“Š

 

Ran Tzur

About the author

Ran Tzur
Senior Solution Engineer at TestProject that loves Python and Java, but loves tennis and building my own PC’s even more! Willing to build a robot that will win all my tennis matches πŸŽΎπŸ€–

Join TestProject Community

Get full access to the world's first cloud-based, open source friendly testing community. Enjoy TestProject's end-to-end test automation Platform, Forum, Blog and Docs - All for FREE.

Join Us Now  

Comments

5 3 comments
  • Avatar
    bhagya M C December 7, 2020, 9:05 am

    Very nice, i will try it.

  • Avatar
    bhagya M C December 7, 2020, 3:01 pm

    Hi Ran Tzur,
    I tried from python it worked very well,
    When i tried from jython hitting import issues, what i am missing here:

    C:\Users\bhagym>jython C:\jython2.7.2\Lib\site-packages\robot\run.py F:\Docs\Download\Webservices\Docs\Quiz\Robotic_Tests\MyRobotTestv1.robot
    [ ERROR ] Error in file ‘F:\Docs\Download\Webservices\Docs\Quiz\Robotic_Tests\MyRobotTestv1.robot’ on line 2: Importing test library ‘TestProjectLibrary’ failed: ImportError: No module named TestProjectLibrary
    Traceback (most recent call last):
    None
    PYTHONPATH:
    C:\jython2.7.2\Lib\site-packages
    C:\jython2.7.2\Lib
    __classpath__
    __pyclasspath__/
    CLASSPATH:
    C:\jython2.7.2\jython.jar

    i can run this with java?
    TestProjectLibrary missing lib.

Leave a Reply

popup image

Complete E2E Automation Solution!

Join over 60K users (from Wix, IBM, Payoneer and many more!) using the world's first FREE cloud-based test automation platform, supported by the #1 testing community.
Sign Up Now right arrow
FacebookLinkedInTwitterEmail