Robot Test Automation Framework in Python for Socket Programming
About 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. Robot Framework is operating system and application independent. The core framework is implemented using Python and also runs on Jython (JVM) and IronPython (.NET).
Why to use Robot Framework?
Robot Framework is a generic keyword-driven test automation framework for acceptance level testing and acceptance test-driven development (ATDD). Robot Framework is extremely easy to set up, use and modify.
How to use Robot Framework?
Basic Setup
To get started with Robot Framework you first need to install Python and pip. If you have the environment properly configured you can just execute the below commands at command lines:
pip install robotframework
pip install robotframework-seleniuimlibrary
Creating Robot Framework Compatible Test Cases
Lets see with an example to use this framework. In this article i will be using Python Socket Programming code to connect to a server, send message and verify the responses. Following files were created to integrate the Message Decoder code into Robot Framework.
• MessageDecoder.resource –Contains all the Keywords.
• MessageDecoder.robot- Our Test Case is available in this file.
• MessageDecoder.py- Python file having all the necessary functions to interact with DB Server.
• Message_Decoder_Params.xlsx- Test data sheet.
Implementation of Python Socket Programming
By using Socket library from Python, we were going to perform client server communication, we could:
• Successfully connect to server.
• Able to send message to the server and
• Able to capture response back for verification.
Test Case File:
Test Resources File
Python Custom Library file
Test Execution Reports