Skip to main content

A tool for inserting Robot Framework test run results into SQL database using SQLAlchemy.

Project description

https://travis-ci.org/pbylicki/DbBot-SQLAlchemy.svg?branch=master

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 is a fork of DbBot project that is using SQLAlchemy in order to store test run results in any of the major supported database systems.

The goal is to support the following databases:

  • PostgreSQL

  • MySQL

  • Oracle

  • MS SQL

  • SQLite

Requirements

DbBot-SQLAlchemy is tested on

It may (though it is not guaranteed) work with older versions of dependencies.

How it works

The script takes one or more output.xml files as input, initializes the database schema, and stores the respective results into a SQLite database (robot_results.db by default, can be changed by specifying SQLAlchemy database URL with options -b or –database). If database schema is already existing, it will insert the new results into that database.

Installation

This tool is installed with pip with command:

$ pip install dbbot-sqlalchemy

Alternatively you can download the source distribution, extract it and install using:

$ python setup.py install

What is stored

Both the test data (names, content) and test statistics (how many did pass or fail, possible errors occurred, how long it took to run, etc.) related to suites and test cases are stored by default. However, keywords and related data are not stored as it might take order of magnitude longer for massive test runs. You can choose to store keywords and related data by using -k or –also-keywords flag.

Usage examples

Typical usage with a single output.xml file:

python -m dbbot.run atests/testdata/one_suite/test_output.xml

If the database does not already exist, it’s created. Otherwise the test results are just inserted into the existing database. Only new results are inserted.

The default database is SQLite database named robot_results.db.

Additional options are:

Short format

Long format

Description

-k

–also-keywords

Parse also suites’ and tests’ keywords

-v

–verbose

Print output to the console.

-b DB_URL

–database=DB_URL

SQLAlchemy database URL for test run results

-d

–dry-run

Do everything except store the results.

Specifying custom database name:

$ python -m dbbot.run  -b sqlite:///my_own_database.db atests/testdata/one_suite/test_output.xml
$ python -m dbbot.run  -b postgresql://postgres:postgres@localhost:5432/postgres atests/testdata/one_suite/test_output.xml

Parsing test run results with keywords and related data included:

python -m dbbot.run -k atests/testdata/one_suite/test_output.xml

Giving multiple test run result files at the same time:

python -m dbbot.run atests/testdata/one_suite/test_output.xml atests/testdata/one_suite/output_latter.xml

Database

You can inspect the created database using the sqlite3 command-line tool:

$ sqlite3 robot_results.db

sqlite> .tables
arguments        suite_status     test_run_errors  tests
keyword_status   suites           test_run_status
keywords         tag_status       test_runs
messages         tags             test_status

sqlite> SELECT count(), tests.id, tests.name
        FROM tests, test_status
        WHERE tests.id == test_status.test_id AND
        test_status.status == "FAIL"
        GROUP BY tests.name;

Please note that when database is initialized, no indices are created by DbBot. This is to avoid slowing down the inserts. You might want to add indices to the database by hand to speed up certain queries in your own scripts.

For information about the database schema, see doc/robot_database.md.

Use case example: Most failing tests

One of the common use cases for DbBot is to get a report of the most commonly failing suites, tests and keywords. There’s an example for this purpose in examples/FailBot/bin/failbot.

Failbot is a Python script used to produce a summary web page of the failing suites, tests and keywords, using the information stored in the DbBot database. Please adjust (the barebone) HTML templates in examples/FailBot/templates to your needs.

Writing your own scripts

Please take a look at the modules in examples/FailBot/failbot as an example on how to build on top of the classes provided by DbBot to satisfy your own scripting needs.

License

DbBot is released under the Apache License, Version 2.0.

See LICENSE.TXT for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dbbot-sqlalchemy-karate-0.5.tar.gz (13.7 kB view details)

Uploaded Source

Built Distributions

dbbot_sqlalchemy_karate-0.5-py3.9.egg (19.9 kB view details)

Uploaded Source

dbbot_sqlalchemy_karate-0.5-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

Details for the file dbbot-sqlalchemy-karate-0.5.tar.gz.

File metadata

  • Download URL: dbbot-sqlalchemy-karate-0.5.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7

File hashes

Hashes for dbbot-sqlalchemy-karate-0.5.tar.gz
Algorithm Hash digest
SHA256 5856f4bda4f110245b64491969e2c0a3ee4634b2abd8f744a6c0953f2dd710a8
MD5 32a7605aa4a4f877a065f02f83134e55
BLAKE2b-256 8a7ff383deb860fac36a808b112746cb50e31ca863a639a2874e51a15a5a0ab6

See more details on using hashes here.

File details

Details for the file dbbot_sqlalchemy_karate-0.5-py3.9.egg.

File metadata

  • Download URL: dbbot_sqlalchemy_karate-0.5-py3.9.egg
  • Upload date:
  • Size: 19.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7

File hashes

Hashes for dbbot_sqlalchemy_karate-0.5-py3.9.egg
Algorithm Hash digest
SHA256 31f51e6e8e87a9f4670d9f5520fc5c57de1afad94e3c83e5be3bb966961ff1a2
MD5 940a4b3d4aa6da4f3a98e886e69c7adf
BLAKE2b-256 4a6b913bd95dc05e703dbc6b0d90780d5e935cc12957000253166a0ad3089e7c

See more details on using hashes here.

File details

Details for the file dbbot_sqlalchemy_karate-0.5-py3-none-any.whl.

File metadata

  • Download URL: dbbot_sqlalchemy_karate-0.5-py3-none-any.whl
  • Upload date:
  • Size: 15.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7

File hashes

Hashes for dbbot_sqlalchemy_karate-0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 5b7486622a0fd78f343b0a1a40082b7bc89fba2461750343215fdb38f789cb88
MD5 5f595abecaa2ebc031b729661801fb01
BLAKE2b-256 db6779636bcc46b9378117c2891d3c57f04bc6e971a94a9a1686ea376365ba38

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page