Extend robotframework using the robotframework python lib core

What is robotframework?

It can save automation developers hours of coding and debugging.

robotframework tool chain diagram
  • SeleniumLibrary — The most commonly used library, provides easy accesses to the selenium api to write web testing automation.
  • AppiumLibrary — Mobile automation library based on appium
  • RESTInstance — Easy contract testing to restful protocols.
  • DataDriver — Library for quick data-driven testing, spare you from code duplication by generating tests based on data.
  • Faker — Access to the python faker library, allows you to generate fake data for your tests.
  • Pabot — for test parallelization.

It can be explained easily to non-coders

*** Settings ***
Documentation A test suite with a single test for valid login.
...
... This test has a workflow that is created using keywords in
... the imported resource file.
Resource resource.txt

*** 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

Comprehensive reports

report html

Easy coding setup

Easy to extend

-test.robot
-extensions
- __init__.py
- my_library.py
def my_foo_keyword_stateless(message: str) -> None:
print(message)
*** Settings ***
Library extensions/my_library.py
*** Test Cases ***
My Test
My Foo Keyword Stateless hello world
pip install robotframework==4.0.3
robot -d results test.robot
C:\Users\user\Desktop\robot-demo>robot -d results test.robot
==============================================================================
Test
==============================================================================
My Test | PASS |
------------------------------------------------------------------------------
Test | PASS |
1 test, 1 passed, 0 failed
==============================================================================
Output: C:\Users\user\Desktop\robot-demo\results\output.xml
Log: C:\Users\user\Desktop\robot-demo\results\log.html
Report: C:\Users\user\Desktop\robot-demo\results\report.html
C:\Users\user\Desktop\robot-demo>
- test.robot
- GreetingLibrary
- __init__.py
- greeting_library.py
- keywords
- __init__.py
- greeting_keywords.py
*** Settings ***
Library GreetingLibrary
*** Test Cases ***
Test 1
Do Your Greetings
Test 2
Do Your Greetings
from .greeting_library import GreetingLibrary
from typing import Any, List
from robotlibcore import DynamicCore
from .keywords import Greeting
class GreetingLibrary(DynamicCore):libraries: List[Any] = [Greeting()]def __init__(self):
DynamicCore.__init__(self, GreetingLibrary.libraries)
from .greeting_keywords import Greeting
from faker import Faker
from robotlibcore import keyword
from robot.libraries.BuiltIn import logger
class Greeting:
def __init__(self)-> None:
fake = Faker()
self._who = fake.name()
self._cntr = 1

@keyword
def do_your_greetings(self)-> None:
greeting_message = f'I am please to greet you {self._who}, counter={self._cntr}'
logger.console(greeting_message)
logger.info(greeting_message)
self._cntr += 1
pip install robotframework==4.0.3 robotframework-pythonlibcore==3.0.0 Faker==8.10.0
robot -d results -P . test.robot
C:\Users\user\Desktop\robotframework_lib>robot -d results -P . test.robot
==============================================================================
Test
==============================================================================
Test 1 I am please to greet you Mrs. Melissa Santana, counter=1
Test 1 | PASS |
------------------------------------------------------------------------------
Test 2 I am please to greet you Mrs. Melissa Santana, counter=2
Test 2 | PASS |
------------------------------------------------------------------------------
Test | PASS |
2 tests, 2 passed, 0 failed
==============================================================================
Output: C:\Users\user\Desktop\robotframework_lib\results\output.xml
Log: C:\Users\user\Desktop\robotframework_lib\results\log.html
Report: C:\Users\user\Desktop\robotframework_lib\results\report.html

--

--

--

Automation and RPA developer, python developer.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

READ/DOWNLOAD@^ Embedded System Design: A Unified Hardware/Software Introduction FULL BOOK PDF &…

Google Cloud Platform: Continuous Deployment to Cloud Run with Cloud Build in Different Env(Dev…

Excluding Dart code from the release compiled executable

DDD modelling beyond software

Testing with Capybara the Basics

Implementing a use case (IV) — Domain Events (II)

1.0 DEFINITION OF GAMEFI GameFi is one of the hottest topic in the cryptocurrency world with the…

Top Trending Programming Languages to Learn in 2019

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Eldad Uzman

Eldad Uzman

Automation and RPA developer, python developer.

More from Medium

VSCode create Big Data Maven/Java Project on WSL2 Ubuntu on Windows

Installing a Graphical User Interface (GUI) on AWS EC2 Linux-2 Instance and accessing it over a…

Introduction to Continuous Integration and Continuous Delivery with Python Flask

Create a Simple Python Web Server on OCI