https://github.com/elirianne/robocon25-examples
Examples of flattening topl-level keywords by Robot Framework API and other tools
https://github.com/elirianne/robocon25-examples
examples listener robocon-2025 robotframework visitor
Last synced: 6 months ago
JSON representation
Examples of flattening topl-level keywords by Robot Framework API and other tools
- Host: GitHub
- URL: https://github.com/elirianne/robocon25-examples
- Owner: Elirianne
- Created: 2025-01-29T16:26:55.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-03-01T22:09:48.000Z (7 months ago)
- Last Synced: 2025-04-05T21:16:13.573Z (6 months ago)
- Topics: examples, listener, robocon-2025, robotframework, visitor
- Language: RobotFramework
- Homepage:
- Size: 5.86 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Flattening Top-Level Keywords with Robot Framework API
This repository contains simple showcases of flattening the top level keywords of a test case using the Robot Framework API's `Listener` and the `Result Visitor`, as well as a third-party library for parsing XML.
> [!NOTE]
> Examples are simplified for the purpose of the presentation at the RoboCon 2025 conference
> and should not be considered as final or recommended solutions.## 1. Project structure
```
|—— Resources
| |—— Common.resource -- Resource file with common keywords
| |—— RobotFrameworkWeb.resource -- Resource file with specific keywords for web app
|—— Tests
| |—— Search.robot -- Example of a test case for the search functionality
|—— Tools
| |—— 01_Listener.py -- Resource containing a simple custom listener
| |—— 02_ResultVisitor.py -- Script for modifying output.xml with a simple Result Visitor
| |—— 03_XMLParser.py -- Script for modifying output.xml with a third-party library
```## 2. Installation
You can install the required dependencies into your Python by running the following commands from the repository root folder:
```bash
python -m venv .venv.\.venv\Scripts\activate
pip install -r requirements.txt
rfbrowser init
```After the inicialization of `rfbrowser` is done, you should be set to run the examples.
## 3. Running the examples
You can run the flattening examples in any order by running the following commands from the repository root folder.
> [!NOTE]
> Examples may contain additional commands with rebot for the purpose of generating
> a new `log.html` where the results of the flattening can be easily observed.### 3.1 Listener
```bash
robot -d Results --listener .\Tools\01_Listener.py Testsrebot -d Results -o flattened_output.xml --flattenkeywords tag:robot:flatten Results\output.xml
```We will end up with a new `log.html` file where the keywords from the second level and further are hidden.
### 3.2 Result Visitor
```bash
robot -d Results Testspython .\Tools\02_ResultVisitor.py
rebot -d Results Results\flattened_output.xml
```We will end up with a new `log.html` file where the keywords from the second level and further are hidden.
### 3.3 XML Parser
```bash
robot -d Results Testspython .\Tools\03_XMLParser.py
rebot -d Results Results\flattened_output.xml
```We will end up with a new `log.html` file where the keywords from the second level and further are hidden.
### 4. Contributions
You are welcomed to try your own experiments with the Robot Framework API in this project :-) If you have any suggestions for improvements or other ideas on how to dynamically flatten the top level keywords, feel free to share them via discussions, issues and so on.