Overview:
In this article, lets see how we can use DbBot + MySQL + Grafana to archive all our robot framework test results and create an robot framework test execution dashboard.
Personally, I would prefer to use TestArchiver + PostgreSQL + Grafana for storing my robot framework test execution results. By using this method you can leverage the archived results for AI Predictions / Analysis in future. You can find more details in RF + PostgreSQL + Grafana
Key Benefits:
- Unified storage for the test run results
- Archiving your test results to PostgreSQL database
- Meeting the test data challenge for AI and ML
Metrics Covered:
- Execution Status – Latest
- Total Executions – Over Time Period
- Average Pass and Failure Percentage
- Top 5 Failed Test Cases
- All Execution Status Over Time Period
- Average Execution Time
- Execution Trend Graph
Grafana & MySQL Integration:
MySQL Setup:
Grafana Setup:
- Download Grafana – Version > 7.0
- Use the following link to setup Grafana
- Start the Grafana server
- Launch browser with this URL http://localhost:3000 to access the Grafana home page

- Update Grafana data source to point to the MySQL instance
- Click on Configuration Menu in the Left Panel and Select Datasource
- Click on Add data source and select MySQL database
- Enter MySQL server details as below and click on Save & Test. The connection should be successful.

Once integrating MySQL and Grafana is completed, then the next step is to send the robot test results data to MySQL DB and enable the default Grafana dashboard.
Robot Framework & MySQL Integration:
Well at this point, I assume that you have Python 3+, Robot Framework installed already and you are running your automated test cases.
Additionally, if you have few robot test results output.xml files then it would be very helpful for you to follow the below details.
Python Library Setup:
We will be using the following libraries in order to parse the robot framework output.xml to MySQL database. Use the below command to install the libraries.
I have upgraded below libraries to Python 3+ and a slight update on the table data type to suit the standards of MySQL. Please use the following link to download the libraries – Download.
- DbBot
- DbBot-SQLAlchemy:
DbBot & DbBot-SQLAlchemy
DbBot is a Python script to serialize `Robot Framework` output files into a SQLite database. This way the future `Robot Framework` related tools and plugins will have a unified storage for the test run results.
DbBot-SQLAlchemy supports the following databases – MySQL | PostgreSQL | Oracle | SQLite. Please refer the below link if you would like to view additional options dbbot-sqlalchemy
Now we are all set to push the report to MySQL DB. Please use the below command
Example:
Below is the sample command line code after replacing all the parameters specific to project for reference.
You can choose to store keywords and related data by using `-k` or `–also-keywords` flag.
Robot Framework Test Results in Grafana Dashboard:
Grafana Plugins:
We will have to install following grafana plugins to incorporate the robot framework dashboard.
- Click on Configuration Menu in the Left Panel and Select Plugins
- Click on Find more plugins Grafana.com and Search for below plugins
Select Panel under Plugin Type and Click on Pie Chart I D3 Gauge
Please follow the instruction in the below plugin installation page and install the plugins


I have created a decent looking dashboard and published them under grafana dashboards. You can download the pre-build dashboards using the following link Robot Framework Grafana Dashboard
The downloaded zip file should also contain the Grafana dashboards (in JSON format). Import those dashboard files in Grafana (You can find the Import feature under Home as shown below).
Once it successfully imports, It will create dashboards as shown below.

QA Manager | Automation Solution Architect | RPA – Software Robot Developer |
“I have learned how to learn quicker”
I am passionate about learning modern technologies and implementing them in my existing workstream. I love to automate every task we repeatedly perform in the workplace… Read more on CognitiveQE
Really love it
Awesome !!
Great Work!
Really great.. This report will work for web automation (Robot framework – Website automation)
Thank you!! Grafana dashboard can be configured for all type of automation using robot framework (UI, API, Backend etc)
You JSON dashboard requires MySQL source, how can I adjust it to accept other type of data source?
@Alex I’ve facing the same issue, I’d like this to use Postgresql I’ve updated the json and replaced MySQL with Postgresql hoping that would be a quick fix, but this doesn’t appear to be the case, would be nice to have this working a different data source
Currently the dashboard is setup in sync with MySQL db. I am in progress of creating another dashboard with PostgreSQL once completed I will publish another post soon.
I need to Robot Framework Test Results in Grafana Dashboard – Part2
Work in progress, I will publish it soon. For sure you will see how its been connected to AI approach
I need to support error
File “C:\Python37\lib\site-packages\sqlalchemy\sql\elements.py”, line 293, in _execute_on_connection
return connection._execute_clauseelement(self, multiparams, params)
File “C:\Python37\lib\site-packages\sqlalchemy\engine\base.py”, line 1101, in _execute_clauseelement
distilled_params,
File “C:\Python37\lib\site-packages\sqlalchemy\engine\base.py”, line 1250, in _execute_context
e, statement, parameters, cursor, context
File “C:\Python37\lib\site-packages\sqlalchemy\engine\base.py”, line 1478, in _handle_dbapi_exception
util.reraise(*exc_info)
File “C:\Python37\lib\site-packages\sqlalchemy\util\compat.py”, line 153, in reraise
raise value
File “C:\Python37\lib\site-packages\sqlalchemy\engine\base.py”, line 1246, in _execute_context
cursor, statement, parameters, context
File “C:\Python37\lib\site-packages\sqlalchemy\engine\default.py”, line 588, in do_execute
cursor.execute(statement, parameters)
File “C:\Python37\lib\site-packages\MySQLdb\cursors.py”, line 199, in execute
args = tuple(map(db.literal, args))
File “C:\Python37\lib\site-packages\MySQLdb\connections.py”, line 245, in literal
s = self.string_literal(o.encode(self.encoding))
UnicodeEncodeError: ‘latin-1’ codec can’t encode characters in position 27-42: ordinal not in range(256)
Please help me
Sorry for late response, Please let me know if you still face the issue. I will help out.
I have done the configuration after running the command i am getting the below error
python3.6 -m dbbot.run -b mysql://grafanaReader:123@localhost/robot_results /var/lib/jenkins/workspace/HydraFunctionality/output.xml
_mysql.connection.query(self, query)
sqlalchemy.exc.OperationalError: (_mysql_exceptions.OperationalError) (1071, ‘Specified key was too long; max key length is 3072 bytes’)
[SQL:
CREATE TABLE suites (
id INTEGER NOT NULL AUTO_INCREMENT,
suite_id INTEGER,
xml_id VARCHAR(64) NOT NULL,
name VARCHAR(256) NOT NULL,
source VARCHAR(1024),
doc TEXT,
PRIMARY KEY (id),
CONSTRAINT unique_suites UNIQUE (name, source),
FOREIGN KEY(suite_id) REFERENCES suites (id)
Please give me few days I will publish a download link, you can use it to resolve the above issue
Hi, is it solution for that problem?
Hey Sridhar.. Thanks for this document.. This is very helpfull I am also facinf the same issue. Is the download link already publisher to solve this issue ?
Hi Please update the Var in the config file to 1024 .. this should resolve the issue
Thanks Shidhar ! Can you please help as to which config file you are referring to ? Few more details will help me.
I have changed the following in python3.8/site-packages/dbbot/reader/database_writer.py
def _create_table_suites(self):
return self._create_table(‘suites’, (
Column(‘suite_id’, Integer, ForeignKey(‘suites.id’)),
Column(‘xml_id’, String(1024), nullable=False),
Column(‘name’, String(1024), nullable=False),
Column(‘source’, String(1024)),
Column(‘doc’, Text)
), (‘name’, ‘source’))
Initially xml var 64 and name was 256. I still get the same error.
Just to Inform this worked by changing Column(‘source’, String(1024)), to Column(‘source’, String(512)),
Thank you Vivek for providing additional info
DROP DATABASE db_name;
CREATE DATABASE db_name;
ALTER DATABASE db_name CHARACTER SET utf8;
Good article and straight to the point. I don’t know if this is truly the best place to ask but do you guys have any thoughts on where to get some professional writers? Thank you 🙂
Thank you 🙂 I have learned by referring huge no of websites. Thanks again even its one article there is a huge effort behind it to get to my expectation.
I think other web site proprietors should take this website as an model, very clean and wonderful user genial style and design, let alone the content. You’re an expert in this topic!
When I run this command… python -m dbbot.run -b mysql://grafanaReader:database1@local3306/robot_results ./output.xml
I’m getting this error….
/usr/local/bin/python3.7: Error while finding module specification for ‘dbbot.run’ (ModuleNotFoundError: No module named ‘dbbot’)
Anyone else run into this? This is the only thing that I have left to do.
Please do pip install dbbot
After installing pip install dbbot…
Requirement already satisfied: dbbot in /Library/Python/2.7/site-packages (0.1)
Requirement already satisfied: robotframework in /Library/Python/2.7/site-packages (from dbbot) (3.1.2)
And here’s the outcome…
~ % python -m dbbot.run -b mysql://grafanaReader:database1@local3306/robot_results ./output.xml
/usr/local/bin/python: Error while finding module specification for ‘dbbot.run’ (ModuleNotFoundError: No module named ‘dbbot’)
~ % python3 -m dbbot.run -b mysql://grafanaReader:database1@local3306/robot_results ./output.xml
/usr/local/bin/python3: Error while finding module specification for ‘dbbot.run’ (ModuleNotFoundError: No module named ‘dbbot’)
python3.7 -m dbbot.run -b mysql://grafanaReader:database1@local3306/robot_results ./output.xml
/usr/local/bin/python3.7: Error while finding module specification for ‘dbbot.run’ (ModuleNotFoundError: No module named ‘dbbot’)
Here’s how my /usr/local/bin/looks like…. https://a.cl.ly/4gum8W2Q
I’m sure this is a environment issue on my side though.
After installing pip install dbbot…
Requirement already satisfied: dbbot in /Library/Python/2.7/site-packages (0.1)
Requirement already satisfied: robotframework in /Library/Python/2.7/site-packages (from dbbot) (3.1.2)
And here’s the outcome…
~ % python -m dbbot.run -b mysql://grafanaReader:database1@local3306/robot_results ./output.xml
/usr/local/bin/python: Error while finding module specification for ‘dbbot.run’ (ModuleNotFoundError: No module named ‘dbbot’)
~ % python3 -m dbbot.run -b mysql://grafanaReader:database1@local3306/robot_results ./output.xml
/usr/local/bin/python3: Error while finding module specification for ‘dbbot.run’ (ModuleNotFoundError: No module named ‘dbbot’)
python3.7 -m dbbot.run -b mysql://grafanaReader:database1@local3306/robot_results ./output.xml
/usr/local/bin/python3.7: Error while finding module specification for ‘dbbot.run’ (ModuleNotFoundError: No module named ‘dbbot’)
Here’s how my /usr/local/bin/looks like…. https://a.cl.ly/4gum8W2Q
I’m sure this is a environment issue on my side though.
Teria como fazer o mesmo processo, usando PyCharm no lugar do MySQL?
I followed all the steps mentioned here, but once i open the dashboard it gives me the error,
“Invalid type for column time, must be of type timestamp or unix timestamp, got: “,
and I fixed another couple of errors
1. To fix the timestamp error I modified the fetchid function.
2.sqlalchemy.exc.OperationalError: (_mysql_exceptions.OperationalError) (1071, ‘Specified key was too long; max key length is 3072 bytes’)
this error was fixed by changing the ‘source VARCHAR(1024)’ to ‘source VARCHAR(512)’ in the SQL to create suites table.
can you please help me fix this error ‘ “Invalid type for column time, must be of type timestamp or unix timestamp, got: “‘.
Hi, where you change that VARCHAR, in which lib / file?
You should find config file as a part of dbbot schema creation.. Please update the varchar to 1024.. Sorry for late reply..
thanks Sridhar for you all your help. I need help in creating a dashboard where it would display the test suite counts and list the test suites. As each test suite contains single test case and this test case contains keywords.
Could you please create/ help me in creating the dashboard for the same.
Hi I am working another enhanced dashboard.. soon will publish it in the first half of july..
Hi I have posted a new article on how to setup the dashboard using PostgreSQL – Simple and more reliable solution .. Take a look at https://cognitiveqe.com/robot-framework-test-results-in-grafana-postgresql/
Hi , I am getting this error when the table schema is getting created. Already same issue has been observed by someone. Do we have a solution now for the same ?
File “/Users/vivek/.pyenv/versions/3.8.3/lib/python3.8/site-packages/MySQLdb/connections.py”, line 259, in query
_mysql.connection.query(self, query)
sqlalchemy.exc.OperationalError: (MySQLdb._exceptions.OperationalError) (1071, ‘Specified key was too long; max key length is 3072 bytes’)
[SQL:
CREATE TABLE suites (
id INTEGER NOT NULL AUTO_INCREMENT,
suite_id INTEGER,
xml_id VARCHAR(64) NOT NULL,
name VARCHAR(256) NOT NULL,
source VARCHAR(1024),
doc TEXT,
PRIMARY KEY (id),
CONSTRAINT unique_suites UNIQUE (name, source),
FOREIGN KEY(suite_id) REFERENCES suites (id)
)
]
I am facing the same issue while running python -m dbbot.run -b mysql://grafanaReader Command. Any luck??
python -m dbbot.run -b mysql://root:*****@13:2056:**/robot_results path_to_output_xml/output.xml. while using this command I am getting OperationalError: (1044, “Access denied for user ‘root’@’%’ to database ‘web_test'”) .
Please create the grafana user as per the post and try again ..
Thanks for your hardwork; that is great ! 🙂
It works well except the fact that the query variable ‘$application’ doesn’t work in any of the grafana graphics. 4 graphics are well displayed (so it retrieves the metrics from my mysql database), but changing the query variable named Application won’t change a thing.
The 4 graphics down are – I believe – because of this query variable. Do you know what is the reason of this defunct ?
I am using Grafana v7.1.4 and mysql 5.7.30 (working in a Kubernetes cluster).
For example, one of the query that is down from Grafana :
SELECT started_at AS “time”, count(started_at)
FROM suites
inner join suite_status on suite_status.suite_id = suites.id
inner join test_runs on suite_status.test_run_id = test_runs.id
WHERE $__timeFilter(started_at) and suites.name = ‘$application’
ORDER BY started_at;
Thank you Hayden for your support.. Query variable application is nothing but your test suite name or the robot file name which is internally stored as suite name in dB ..
Thanks for answering this quick.
You are right that gives me the test suite name (for my case, it is simpletest and Test) but the bug remains.
From grafana, the result of the query is :
A:Object
error:”Query failed. Please inspect Grafana server log for details”
refId:”A”
meta:Object
executedQueryString:”SELECT started_at AS “time”, count(started_at) FROM suites inner join suite_status on suite_status.suite_id = suites.id inner join test_runs on suite_status.test_run_id = test_runs.id WHERE started_at BETWEEN FROM_UNIXTIME(1598455945) AND FROM_UNIXTIME(1598459545) and suites.name = ‘Test’ ORDER BY started_at;”
Do you please have a clue about what’s happening ?
Has someone get the same error ?
Hi Hayden .. Do you still have issues .. One of my suggestion is to go prefer following implementation with PostgreSQL.. You have great benefit in future to run your AI on the test results .. Post reference https://cognitiveqe.com/robot-framework-test-results-in-grafana-postgresql/
Please do click on the like button and provide your review comments- star button to encourage us to post more such articles 🙂
awesome integration… liked it 👍
Thank you so much
Hi Sridhar,
I am trying to use MySQL and observing the error below:
sqlalchemy.exc.OperationalError: (MySQLdb._exceptions.OperationalError) (1071, ‘Specified key was too long; max key length is 3072 bytes’)
[SQL:
CREATE TABLE suites (
id INTEGER NOT NULL AUTO_INCREMENT,
suite_id INTEGER,
xml_id VARCHAR(64) NOT NULL,
name VARCHAR(256) NOT NULL,
source VARCHAR(1024),
doc TEXT,
PRIMARY KEY (id),
CONSTRAINT unique_suites UNIQUE (name, source),
FOREIGN KEY(suite_id) REFERENCES suites (id)
)
]
(Background on this error at: http://sqlalche.me/e/13/e3q8)
Hi Chandika we have few solutions proposed with comments… Additional please look into postgresql implementation which is a solid solution … Refer my another post
Hi all,
Getting the following error.
Error 1146: Table ‘grafana-robot.pivot_environment_test’ doesn’t exist
I don’t see any reference to this table anywhere. Any ideas?
TIA
Don’t worry, turns out it was a custom table created by a developer before me
python -m dbbot.run -b MySQL://grafanaReader:password@dockerip:3306/robot_results ./reports/output.xml
Getting following error.
Traceback (most recent call last):
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py”, line 174, in _run_module_as_main
“__main__”, fname, loader, pkg_name)
File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py”, line 72, in _run_code
exec code in run_globals
File “/Users/sreelesh/Library/Python/2.7/lib/python/site-packages/dbbot/run.py”, line 53, in
DbBot().run()
File “/Users/sreelesh/Library/Python/2.7/lib/python/site-packages/dbbot/run.py”, line 31, in __init__
self._db = DatabaseWriter(database_url, verbose_stream)
File “/Users/sreelesh/Library/Python/2.7/lib/python/site-packages/dbbot/reader/database_writer.py”, line 25, in __init__
self._engine = create_engine(db_url)
File “/Users/sreelesh/Library/Python/2.7/lib/python/site-packages/sqlalchemy/engine/__init__.py”, line 386, in create_engine
return strategy.create(*args, **kwargs)
File “/Users/sreelesh/Library/Python/2.7/lib/python/site-packages/sqlalchemy/engine/strategies.py”, line 51, in create
entrypoint = u._get_entrypoint()
File “/Users/sreelesh/Library/Python/2.7/lib/python/site-packages/sqlalchemy/engine/url.py”, line 131, in _get_entrypoint
cls = registry.load(name)
File “/Users/sreelesh/Library/Python/2.7/lib/python/site-packages/sqlalchemy/util/langhelpers.py”, line 205, in load
(self.group, name))
sqlalchemy.exc.NoSuchModuleError: Can’t load plugin: sqlalchemy.dialects:MySQL
Could you please help to fix error. I tried with mysql and MySQL , again getting error
Hi please try with python3 .. I would recommend to move to other post which uses postgresql db .. Libraries are updated frequently and it would be permanent solution
Hi Am facing error when executing the command to push
C:\Users\v00846>python -m dbbot.run -b mysql://grafanaReader:1234@localhost/robot_results ./output.xml
Traceback (most recent call last):
File “C:\Python38\lib\runpy.py”, line 183, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File “C:\Python38\lib\runpy.py”, line 153, in _get_module_details
code = loader.get_code(mod_name)
File “”, line 916, in get_code
File “”, line 846, in source_to_code
File “”, line 219, in _call_with_frames_removed
File “C:\Python38\lib\site-packages\dbbot\run.py”, line 43
except DataError, message:
^
SyntaxError: invalid syntax
Hi Saravanan dbbot library is decommissioned please use my other post with postgresql db .. in case if you don’t have any options let me know I will try to reproduce above issue and fix it
Hi,
Thank you @Sridhar VP for this article, it’svery interesting.
Do someone know how to display test keywords and related data included on Grafana after parsing them with the option `–also-keywords` ?
Thank’s in advance.
Hi, I am planning add keyword specific grafana panel by next month
Love the dashboard. Any plans for adding on more to it? Does the skipped status show on the dashboard as thats now in RFv4? Also noticed with the new robot framework version 4 dbbot-sql alchemy breaks importing the xml as the xml format has changed. Logged an issue with the repo.
Thank you for your comments .. Please give sometime I am testing with RF4 and also merged a PR with TestArchiver to support RF4 .. I will update a latest version of dashboard soon..
Is there any update with RF4.0 issue
It’s been used with 4.0 .. no issues .. pls let me know in case if you see any issues
Awesome post. Have you created docker images for these implementations?
i have tried the below command ,
python -m dbbot.run .\output.xml
however ended up with below error.
AttributeError: ‘TotalStatistics’ object has no attribute ‘all’
any solution for this ?
also when i tried to insert the data into DB directly i got some other error. any help would be appreciated.
sqlalchemy.exc.OperationalError: (MySQLdb._exceptions.OperationalError) (1071, ‘Specified key was too long; max key length is 3072 bytes’) .
”
command used : python -m dbbot.run -b mysql://robot_user:password@grafana.ekinops.com/robot_db output.xml
I have this error when I run dbbot, do you have any suggestion to face this error ?
sqlalchemy.exc.OperationalError: (MySQLdb.OperationalError) (1071, ‘Specified key was too long; max key length is 3072 bytes’)
Hello Sridhar,
thank you for the detailed steps.
I can insert the data, but some of the dashboard components are not displayed.
https://www.imagebam.com/view/MEG3NGU
https://www.imagebam.com/view/MEG3NH5
could you please help?
observing below error how to solve it
c:\results\1>
c:\results\1>py -m dbbot.run -b mysql://ride:RadioMobile12@localhost/robot_results ./output.xml
Traceback (most recent call last):
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\runpy.py”, line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\runpy.py”, line 86, in _run_code
exec(code, run_globals)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\dbbot\run.py”, line 53, in
DbBot().run()
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\dbbot\run.py”, line 44, in run
self._parser.xml_to_db(xml_file, self._options.build_number, self._options.branch_repo)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\dbbot\reader\robot_results_parser.py”, line 35, in xml_to_db
suite_metadata = list(test_run.suite.metadata.values())[0]
IndexError: list index out of range
c:\results\1>
c:\results\1>