Last Updated Aug 09, 2020 — Guy Arieli, CTO Quality
Continuous Testing

Robot Overview

Robot Framework is a test automation framework that makes it easy for QA teams to manage acceptance testing and acceptance test-driven development (ATDD) environments. The tool was first designed by Pekka Klarck in 2005 and developed at Nokia Networks the same year. It was offered as open-source in 2008. Written in Python language, Robot offers a rich ecosystem of libraries and tools while allowing you to integrate it with virtually any test automation solution. The framework also runs on IronPython (.NET) and Jython (JVM). It is platform-agnostic and application-agnostic as well. The tool comes with easy syntax and uses a keyword-driven test approach. The keywords are human-readable. You can use the built-in keywords or create one from scratch. Currently, Robot Framework Foundation now takes care of the development of the tool.

What is Acceptance Testing?

Acceptance testing is a part of a testing project that checks if the software complies with functional specifications and business requirements before pushing it into production. In a typical testing pipeline, unit tests run first. They are followed by integration testing and system testing. Finally, acceptance testing is done to ensure that the software meets all business requirements before it is delivered to end-users. Acceptance testing is normally performed by running Black Box testing.

Acceptance testing is done in two ways for example:

  1. Internal Acceptance Testing: The members of the software company who did not participate in the development of that software will test it.
  2. External Acceptance Testing: Members outside the software company will test it (mostly, clients who ordered that software). Later, end users will test it.

What is Acceptance Test-Driven Development (ATDD)?

Acceptance Test-Driven Development (ATDD) is a user-centric approach to test automation. In a Test-driven Development (BDD) environment, developers write tests from their perspective. ATDD works the other way round. Here, different teams such as Developers, QA, and customers collaborate on preparing acceptance test cases before incorporating the functionality into the application. With a user-centric approach and seamless collaboration between development teams and functional experts, developed applications have a higher chance of meeting acceptance criteria. With ATDD, functional testing becomes easy and effective.

Behavior-driven development (BDD) and ATDD share a lot of similarities. However, they differ in one key aspect. BDD focuses on the behavior of a feature while ATDD focuses on requirements.

The History of Acceptance Test-driven Development

It was Kent Beck who first mentioned the concept of Acceptance test-driven development environment in a book, ‘Test Driven Development: By Example’ in 2003. He opined that it was practically not possible. However, the popularity of Fitnesse open-source test automation tool which provided good collaboration between business stakeholders made ATDD a reality.

ATDD provides a clear understanding of an application’s user requirements while serving as a guide for the entire development project. It also facilitates nice collaboration between different teams. Some of the tools used for ATDD include Robot Framework, TestNG, Fitnesse, Thucydides, and EasyB.

Robot Framework for Acceptance Testing and ATDD

Before proceeding with this framework, it is important to understand some of the key aspects of the tool.

  1. Table-based test cases: The tool enables you to write test cases using keywords in a simple tabular format.
  2. Keywords: The tool offers built-in keywords to write test cases. You can also import keywords from open-source libraries or create your own keywords.
  3. Libraries: The tool supports a range of libraries such as Selenium library, iOS library, Debug library, FTP library, etc.
  4. Resources: The tool allows you to import robot files with keywords from external sources.
  5. Variables: The tool supports three types of variables; scalar variable, dictionary variable, and list variable.
  6. Tags: The tool allows you to tag test cases so that you can add or omit them while running test suites.
  7. Reports and Logs: The tool provides the details of the tests in the form of HTML and log files.

Getting Started with Robot Framework

Here are the prerequisites for running this acceptance testing framework.

  1. Python with PIP
  2. Robot Framework
  3. wxPython
  4. RIDE

Step 1: Install Python

Visit the following website to download Python software.

https://www.python.org/downloads/

Download the latest version for your operating system (eg: Windows)

Robot Framework Python

Double-click the Python software to begin the installation.

robot framework python 32 bit install

You can click on ‘Install Now’ to install the default package. It comes with pip, IDLE, and documentation. Alternatively, you can choose ‘Customize installation’ to select the features of your choice.

Notice that the Setup offers an option ‘Add Python 3.8 to PATH. When you check this box, the tool will automatically update the path of Python in environment variables.

python advanced options

Customize the installation options and choose the location and click Install to begin the installation procedure.

python setup progress

Once finished, you’ll see a thank you note for Mark Hammond who contributed for the Python Windows tool.

python setup success

To check if Python and pip are correctly installed, open the command prompt, and run the version command.

  • python –version
  • pip –version

Note that pip gets installed along with python by default.

python pip

Now, Python and pip are installed and ready for use.

Step 2: Configure Environment Variables

After installing Python and pip, you should configure environment variables by adding the path. To do so,

  • Go to System – > Advanced System Settings – > Advanced – > Environment Variables

environmental variables

Add the path of the folder where Python is installed to the system variables section and user variables section. Here, you see that path is already updated as this option is selected while installing Python.

Step 3: Install Robot Framework

Open the command prompt and navigate to the python folder and type the following command:

  • Pip install robotframework

install robot framework

Robot Framework is successfully installed. You can check it using the version command.

  • robot –version

Step 4: Install wxPython

Download wxPython software from the following link:

Open the command prompt and type the following command:

  • Pip install –u wxPython

robot framework installation

Now, wxPython version 4.1.0 is successfully installed.

Step 5: Install RIDE

To install RIDE, open the command prompt and type the following command.

  • pip install robotframework-ride

install robot framework

Now, RIDE is ready for use.

ride ready

To open RIDE, open the command prompt and type the following command:

  • ride.py

The latest version of Python i.e 3.8.1 doesn’t support RIDE. You have to wait for the Future Ride 2.0. You can download the beta version that is released in Jul 2020 from the GitHub site here:

https://github.com/robotframework/RIDE/releases

Alternately, you can open a command prompt and use pip to install the beta ride version

  • pip install –pre-upgrade Robot Framework-ride==2.0b1

pip install

The pip installs ride beta version.

pip ride variables

Now, open the command prompt and type the following command to open the RIDE editor.

  • ride.py

welcome to ride

Running your First Test Case using Robot Framework

To run your first test case, open the RIDE IDE using the shortcut link on Windows Desktop. Alternatively, you can use the command-line interface to open RIDE.

Open the command prompt and type the following command.

  • ride.py

robot framework test data editor

Click on File -> New project

robot framework new project

Enter a name for your project and click ok.

robot framework enter name

You can find the name of your test project on the left side menu under Test Suites. Right-click on the test project and select the ‘New test case’.

robot new test case

Give a name for your test case and click Ok.

test case name

Now, click on the documentation screen to document the details of the test case.

test case robot experitest

Ride allows you to write scripts in a tabular format. You can add keywords and values for each keyword. For instance, enter the keyword ‘log’ and log the details of the test.

experitest robot test

Click on save to save your test case.

Now, you can click on the start to run the test case. Alternatively, you can run this test case from the command line interface.

Open the command prompt and navigate to the folder of the saved test case. The file saves here under the scripts folder in the robot framework project directory.

  • robot -T Experitest1.robot

robot framework script

The test case is successfully executed. RIDE also creates the output file in the XML format and the report and log files in the HTML format. You can check the report by opening the HTML file. You can open the HTML file directly in windows or use the command prompt to invoke the explorer. Check the name of the report and type the following command in the command prompt

  • Start report-20200729-202047.html

The ride normally stores the report using the data in the YYYY/MM/DD format and the time in HHMMSS format.

experitest test report

To check the test execution log, click on the log on the right top corner. You can also open the log using the CLI

  • Start log-20200729-202047.html

test log

As you can see from the test execution log, the tests are keyword-driven. You can check the keyword and the given message with the given level.

experitest analytics

Another Sample Test – Testing Login Credentials

Here is another sample test that opens a website and validates the login credentials. Additionally, a demo app is used for this test wherein a demo server runs on a localhost at http://localhost:7272

login page

Now, create a new project and a test case and add the following code.

*** Settings ***

  • Documentation Experitest sample test using SeleniumLibrary.
  • Library SeleniumLibrary

*** Variables ***

*** Test Cases ***

  • Valid Login
  • Open Browser To Login Page
  • Input Username demo
  • Input Password mode
  • Submit Credentials
  • Welcome Page Should Be Open
  • [Teardown] Close Browser

*** Keywords ***

  • Open Browser To Login Page
  • Open Browser ${LOGIN URL} ${BROWSER}
  • Title Should Be Login Page
  • Input Username
  • [Arguments] ${username}
  • Input Text username_field ${username}
  • Input Password
  • [Arguments] ${password}
  • Input Text password_field ${password}
  • Submit Credentials
  • Click Button login_button
  • Welcome Page Should Be Open
  • Title Should Be Welcome Page

This test suite will run different test cases and checks the login function with different scenarios such as invalid username, invalid password, successful login etc.

To Conclude

As the business world is moving from a feature-based development towards a user-centric approach, acceptance data-driven development has a key role to play in software development and testing environments. Robot Framework rightly serves this purpose. With keyword-driven testing methods, this open-source makes it easy and cost-effective to run acceptance testing. The easily-readable syntax and easy to use interface makes this tool a good choice for testing companies of all sizes.

If you want to see some other frameworks that can integrate with Digital.ai Continuous Testing take a closer look

Are you ready to scale your enterprise?

Explore

What's New In The World of Digital.ai

February 22, 2024

How Futurism is Shaping Cloud Testing: A Forecast

Unlock the future of cloud testing: strategic approaches to leverage technology effectively, enhance software quality, and ensure business success.

Learn More
December 4, 2023

The Drive for Quality: Continuous Automated Software Testing for the Automotive Industry

From AI-powered test creation to self-healing systems, discover how continuous testing and innovative developments are shaping the future of connected, safe, and reliable vehicles.

Learn More
November 13, 2023

“Don’t Sweat the AI Techniques”: How AI and ML are Revolutionizing Web and Mobile Automated Testing

Discover AI’s role in automated testing—AI-powered creation, self-healing, analytics, and change risk predictions for efficient, high-quality results.

Learn More