Git Product home page Git Product logo

adiralashiva8 / robotframework-historic Goto Github PK

View Code? Open in Web Editor NEW
80.0 9.0 16.0 3.34 MB

Robotframework-historic is a free, custom html report which provides historical robotframework execution results by storing execution results info in MySQL database and generate's html reports (charts / statistics) from database using Flask.

Home Page: https://rfhistoric.netlify.com/

License: MIT License

Python 4.64% HTML 21.22% CSS 36.87% JavaScript 37.26%
robotframework report listener historical-data mysql flask-application

robotframework-historic's Introduction

robotframework-historic

MYSQL + Flask + Robotframework

PyPI version Downloads PRs Welcome Maintenance Open Source Love png1 HitCount

Sample Report (old view) Link


How it Works:

  • Get execution details by parsing output.xml

  • Store execution results in local / remote hosted MySQL database

  • Generate html report from database using Flask

    robotframework-historic-overview

Requirements

  • Python 3.7 or above
  • MySQL DB

Installation

Following steps are one time activity

  • Step 1: Download and Install MySQL Server - guide

  • Step 2: Install robotframework-historic

    Case 1: Using pip

    pip install robotframework-historic==0.2.8
    

    Case 2: Using setup.py (root)

    python setup.py install
    

    Case 3: Using git (latest changes - prefer this)

    pip install git+https://github.com/adiralashiva8/robotframework-historic
    

    Help / Know More

    rfhistoric --help
    rfhistoricparser --help
    rfhistoricsetup --help
    rfhistoricupdate --help
    
  • Step 3: Create rfhistoric default user & robothistoric.TB_PROJECT table

    Case 1: Through command line

    rfhistoricsetup
    

    Case 2: Manual steps

    • Create rfhistoric default guide
    • Create robothistoric.TB_PROJECT table guide

How to use in project

  • Step 1: Create project in robotframework-historic - guide

  • Step 2: Push execution results to project - guide

    Facing mysql issue? try

    pip install mysql-connector-python
    pip install PyMySQL
    
  • Step 3: Open robotframework-historic to view historical results


If you have any questions / suggestions / comments on the report, please feel free to reach me at


โญ repo if you like it


robotframework-historic's People

Contributors

adiralashiva8 avatar koalo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

robotframework-historic's Issues

mysql.connector.errors.ProgrammingError: 1049 (42000): Unknown database 'test'

Hi,
I am getting following error after running rfhistoricupdate

$ rfhistoricupdate
Traceback (most recent call last):
File "/home/ankita/.local/bin/rfhistoricupdate", line 33, in
sys.exit(load_entry_point('robotframework-historic==0.2.9', 'console_scripts', 'rfhistoricupdate')())
File "/home/ankita/.local/lib/python3.6/site-packages/robotframework_historic/updateargs.py", line 39, in main
rfhistoric_update(args)
File "/home/ankita/.local/lib/python3.6/site-packages/robotframework_historic/rfhistoricupdate.py", line 12, in rfhistoric_update
use_db(rfobj, str(item[0]))
File "/home/ankita/.local/lib/python3.6/site-packages/robotframework_historic/rfhistoricupdate.py", line 63, in use_db
cursor.execute("USE %s;" % db_name)
File "/home/ankita/.local/lib/python3.6/site-packages/mysql/connector/cursor.py", line 551, in execute
self._handle_result(self._connection.cmd_query(stmt))
File "/home/ankita/.local/lib/python3.6/site-packages/mysql/connector/connection.py", line 490, in cmd_query
result = self._handle_result(self._send_cmd(ServerCmd.QUERY, query))
File "/home/ankita/.local/lib/python3.6/site-packages/mysql/connector/connection.py", line 395, in _handle_result
raise errors.get_exception(packet)
mysql.connector.errors.ProgrammingError: 1049 (42000): Unknown database 'test'

Thanks

Not able to view historical results in browser.

Hi,
How do I fix following error?

$ rfhistoricupdate
INFO: Updating TB_EXECUTION table of DB ankita
1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(0)' at line 1
1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(0)' at line 1
INFO: Updating TB_SUITE table of DB ankita
1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(0)' at line 1
INFO: Updating TB_TEST table of DB ankita
1060 (42S21): Duplicate column name 'Test_Assigned_To'
1060 (42S21): Duplicate column name 'Test_ETA'
1060 (42S21): Duplicate column name 'Test_Review_By'
1060 (42S21): Duplicate column name 'Test_Issue_Type'
1060 (42S21): Duplicate column name 'Test_Tag'
1060 (42S21): Duplicate column name 'Test_Updated'

Thanks
rf

Support in Ubuntu

Does this robotframework-historic supported in Ubuntu also using MYSQL, if so can you please provide the user guide for the same.

Casing important for MySQL table

The documentation https://github.com/adiralashiva8/robotframework-historic/wiki/2.2-Create-robothistoric-table explains to create a table in uppercase characters (TB_PROJECT), while the sources refer to it in lowercase characters (tb_project). This results in MySQLdb._exceptions.ProgrammingError: (1146, "Table 'robothistoric.tb_project' doesn't exist") on Linux hosts.

The documentation should be adapted accordingly, or even better, the program itself could create the table if it does not exist to make the initial setup easier.

rfhistoric parser "MySQLdb._exceptions.OperationalError: (1140, "In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated column 'test.TB_EXECUTION.Execution_Pass'; this is incompatible with sql_mode=only_full_group_by")"

After cleaning up tables and re-installing of latest version of packages.
Creation of project in dashboard is success,also parser returns no errors.
When click View button on project dashboard reports error.

rfhistoricparser -o "output.xml" -s "localhost" -n "test" -e "smoke"
Capturing execution results, This may take few minutes...
INFO: Capturing suite results
INFO: Capturing test results
INFO: Writing execution results

127.0.0.1 - - [02/Jul/2020 10:24:39] "GET /test/dashboard HTTP/1.1" 500 -
[2020-07-02 10:30:43,918] ERROR in app: Exception on /test/dashboard [GET]
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.6/dist-packages/flask/_compat.py", line 39, in reraise
raise value
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functionsrule.endpoint
File "/usr/local/lib/python3.6/dist-packages/robotframework_historic/app.py", line 92, in dashboard
cursor.execute("select execution_pass, ROUND(MIN(execution_pass),2), ROUND(AVG(execution_pass),2), ROUND(MAX(execution_pass),2) from TB_EXECUTION order by execution_id desc;")
File "/usr/local/lib/python3.6/dist-packages/MySQLdb/cursors.py", line 209, in execute
res = self._query(query)
File "/usr/local/lib/python3.6/dist-packages/MySQLdb/cursors.py", line 315, in _query
db.query(q)
File "/usr/local/lib/python3.6/dist-packages/MySQLdb/connections.py", line 239, in query
_mysql.connection.query(self, query)
MySQLdb._exceptions.OperationalError: (1140, "In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated column 'test.TB_EXECUTION.Execution_Pass'; this is incompatible with sql_mode=only_full_group_by")
127.0.0.1 - - [02/Jul/2020 10:30:43] "GET /test/dashboard HTTP/1.1" 500 -

VIEW is not loading results

Executions are Loaded. But clickin on VIEW is giving below error
'missing newly added required columns in table. Execute rfhistoricupdate command to add columns.'

I tried even after running 'rfhistoricupdate' . Same issue

===rfhistoricupdate
INFO: Updating TB_EXECUTION table of DB CCPA_QA
1060 (42S21): Duplicate column name 'Execution_Skip'
1060 (42S21): Duplicate column name 'Execution_SSkip'
INFO: Updating TB_SUITE table of DB CCPA_QA
1060 (42S21): Duplicate column name 'Suite_Skip'
INFO: Updating TB_TEST table of DB CCPA_QA
1060 (42S21): Duplicate column name 'Test_Assigned_To'
1060 (42S21): Duplicate column name 'Test_ETA'
1060 (42S21): Duplicate column name 'Test_Review_By'
1060 (42S21): Duplicate column name 'Test_Issue_Type'
1060 (42S21): Duplicate column name 'Test_Tag'
1060 (42S21): Duplicate column name 'Test_Updated'

AttributeError: 'NoneType' object has no attribute 'cursor'

rfhistoricparser -o "output.xml" -s "127.0.0.1:3306" -u "superuser" -p "passw0rd" -n "test" -e "Smoke test on v1.0"
<class 'Exception'>
Traceback (most recent call last):
File "/Users/cloud/anaconda3/bin/rfhistoricparser", line 10, in
sys.exit(main())
File "/Users/cloud/anaconda3/lib/python3.7/site-packages/robotframework_historic_parser/runner.py", line 65, in main
generate_report(args)
File "/Users/cloud/anaconda3/lib/python3.7/site-packages/robotframework_historic_parser/rfhistoricparser.py", line 50, in generate_report
result_id = insert_into_results_mysql_table(mydb, date_now, opts.executionname, total, passed, failed, elapsedtime)
File "/Users/cloud/anaconda3/lib/python3.7/site-packages/robotframework_historic_parser/rfhistoricparser.py", line 100, in insert_into_results_mysql_table
cursorObj = con.cursor()
AttributeError: 'NoneType' object has no attribute 'cursor'

Unable to create data base with command: rfhistoric

I followed the same path mentioned in https://github.com/adiralashiva8/robotframework-historic.
And, when I execute the command:- rfhistoric, it opened the page , however, after clicking on Get Started, I received the error :-
**Internal Server Error

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.**

And on the terminal output:-

_mysql.connection.query(self, query)

MySQLdb._exceptions.OperationalError: (1055, "Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'information_schema.tables.CREATE_TIME' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by")
127.0.0.1 - - [24/Feb/2020 18:58:11] "GET /home HTTP/1.1" 500 -

Cannot show dashboardRecent properly.

cursor.execute("SELECT COUNT(*) From (SELECT Test_Name, Execution_Id From TB_TEST WHERE Test_Status='FAIL' AND Execution_Id >= %s GROUP BY Test_Name HAVING COUNT(Test_Name) = 1) AS T WHERE Execution_Id=%s" % (exe_info[1][0],exe_info[0][0]))

Hi Author,
We find out this command cannot execute in mysql db.
This is an error code
Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'UIPSR.TB_TEST.Execution_Id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
image

But when we change to
cursor.execute("SELECT COUNT(*) From (SELECT Test_Name, Execution_Id From TB_TEST WHERE Test_Status='FAIL' AND Execution_Id >= %s GROUP BY Test_Name, Execution_Id HAVING COUNT(Test_Name) = 1) AS T WHERE Execution_Id=%s" % (exe_info[1][0],exe_info[0][0]))
It works. :)

Support uploading log.html

As a rfhistoric user I want to store my log.html into DB so that I can download when required in future

support for common db

Currently, it was accepting only the mysql db connectors. Instead of that, you can provide the option to the users, so users will add their own connectors like (psql, mongo db or mysql db).

Support adding comments

As a rfhistoric user I want to add comments to failures so that I can refer to comments in future

Rf historic "MySQLdb._exceptions.ProgrammingError: (1146, "Table 'robothistoric.tb_project' doesn't exist")"

using ubuntu with mysql.
superuser and db table created succesfully.
Get Started on RFhistoric

$ rfhistoric

  • Serving Flask app "robotframework_historic.app" (lazy loading)
  • Environment: production
    WARNING: This is a development server. Do not use it in a production deployment.
    Use a production WSGI server instead.
  • Debug mode: off
  • Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
    127.0.0.1 - - [01/Jul/2020 14:12:33] "GET / HTTP/1.1" 200 -
    127.0.0.1 - - [01/Jul/2020 14:12:35] "GET / HTTP/1.1" 200 -
    127.0.0.1 - - [01/Jul/2020 14:12:35] "GET / HTTP/1.1" 200 -
    127.0.0.1 - - [01/Jul/2020 14:12:35] "GET / HTTP/1.1" 200 -
    127.0.0.1 - - [01/Jul/2020 14:12:35] "GET / HTTP/1.1" 200 -
    [2020-07-01 14:12:41,428] ERROR in app: Exception on /home [GET]
    Traceback (most recent call last):
    File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
    File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
    File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
    File "/usr/local/lib/python3.6/dist-packages/flask/_compat.py", line 39, in reraise
    raise value
    File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
    File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functionsrule.endpoint
    File "/usr/local/lib/python3.6/dist-packages/robotframework_historic/app.py", line 22, in home
    cursor.execute("select * from tb_project;")
    File "/usr/local/lib/python3.6/dist-packages/MySQLdb/cursors.py", line 209, in execute
    res = self._query(query)
    File "/usr/local/lib/python3.6/dist-packages/MySQLdb/cursors.py", line 315, in _query
    db.query(q)
    File "/usr/local/lib/python3.6/dist-packages/MySQLdb/connections.py", line 239, in query
    _mysql.connection.query(self, query)
    MySQLdb._exceptions.ProgrammingError: (1146, "Table 'robothistoric.tb_project' doesn't exist")
    127.0.0.1 - - [01/Jul/2020 14:12:41] "GET /home HTTP/1.1" 500 -

Create Project In RF Historic is not pushed to remote mysql database

mysqldb and rfhistoric hosted on separate ubuntu vm

With mysql database on remote machine, when creating RF Project on http://0.0.0.0:5000/home, created project (e.g. project name 'remote') is not getting pushed to remote mysqldb.

$ rfhistoricparser -o "output.xml" -s "qamysql01" -u "superuser" -p "xxxxxxx" -n "remote"
Capturing execution results, This may take few minutes...
1049 (42000): Unknown database 'remote'
Traceback (most recent call last):
File "/home/viksingh/.local/bin/rfhistoricparser", line 11, in
sys.exit(main())
File "/home/viksingh/.local/lib/python3.6/site-packages/robotframework_historic_parser/runner.py", line 72, in main
generate_report(args)
File "/home/viksingh/.local/lib/python3.6/site-packages/robotframework_historic_parser/rfhistoricparser.py", line 62, in generate_report
result_id = insert_into_execution_table(mydb, rootdb, opts.executionname, total, passed, failed, elapsedtime, stotal, spass, sfail, opts.projectname)
File "/home/viksingh/.local/lib/python3.6/site-packages/robotframework_historic_parser/rfhistoricparser.py", line 137, in insert_into_execution_table
cursorObj = con.cursor()
AttributeError: 'NoneType' object has no attribute 'cursor'

on remote mysqldb

mysql> show tables;
+-------------------------+
| Tables_in_robothistoric |
+-------------------------+
| TB_PROJECT |
+-------------------------+
1 row in set (0.00 sec)

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| robothistoric |
| sys |
+--------------------+
5 rows in set (0.00 sec)

mysql> show tables;
+-------------------------+
| Tables_in_robothistoric |
+-------------------------+
| TB_PROJECT |
+-------------------------+
1 row in set (0.01 sec)

mysql>

Support upload results from web

As a rfhistoric user I want to push execution results from web instead of parser of listener so this helps for non technical users

Segmentation fault (core dumped)

Hi,
I am getting segmentation fault while parsing output.xml.

$ rfhistoricparser -o output.xml -u "superuser" -p "passw0rd" -n "test"
Capturing execution results, This may take few minutes...
Segmentation fault (core dumped)

how do I fix this?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.