# TestArchiver
TestArchiver is a tool for archiving your test results to a SQL database.
And [Epimetheus](https://github.com/salabs/Epimetheus) is the tool for browsing the results you archived.
## Testing framework support
| Framework | Status | Fixture test status | Parser option |
| --------------- | --------------------------- | ------------------- | ------------- |
| Robot Framework | [Supported](robot_tests/) | Done | robot |
| Mocha | [Supported](mocha_tests/) | Done | mocha-junit |
| pytest | [Supported](pytest/) | Done | pytest-junit |
| PHPUnit | [Supported](phpunit_tests/) | Done | php-junit |
| JUnit | Experimental | Missing | junit |
| xUnit | Experimental | Missing | xunit |
| MSTest | Experimental | Missing | mstest |
Experimental status here means that there is a parser that can take in e.g. generic JUnit formatted output but there is no specific test set or any extensive testing or active development for the parser.
Contributions for output parsers or listeners for different testing frameworks are appreciated. Contributing simply a fixture test set (that can be used to generate output files for developing a specific parser) is extremely helpful for any new framework.
## Installation
`sudo -H python3 -m pip install testarchiver`
## Supported databases
### SQLite
[SQLite](https://www.sqlite.org) default database for the archiver and is mainly useful for testing and demo purposes. Sqlite3 driver is part of the python standard library so there are no additional dependencies for trying out the archiver.
### PostgreSQL
[PostgreSQL](https://www.postgresql.org) is the currently supported database for real projects. For example [Epimetheus](https://github.com/salabs/Epimetheus) service uses a PosrgreSQL database. For accessing PostgreSQL databases the script uses psycopg2 module: `pip install psycopg2-binary` (comes with pip install)
## Basic usage
The output files from different testing frameworks can be parsed into a database using `test_archiver/output_parser.py` script.
```
testarchiver --database test_archive.db output.xml
```
Assuming that `output.xml` is a output file generated by Robot Framework (the default parser option), this will create a SQLite database file named `test_archive.db` that contains the results.
The archiver script can also be invoked from the module:
```
python3 -m test_archiver.output_parser --database test_archive.db output.xml
```
For list of other options: `testarchiver --help`
```
positional arguments:
output_files list of test output files to parse in to the test
archive
optional arguments:
-h, --help show this help message and exit
--version, -v show program's version number and exit
--config CONFIG_FILE Path to JSON config file containing database
credentials and other configurations. Options given on
command line will override options set in a config
file.
--format {robot,robotframework,xunit,junit,mocha-junit,pytest-junit,mstest,php-junit}
output format (default: robotframework)
--repository REPOSITORY
The repository of the test cases. Used to
differentiate between test with same name in different
projects.
--team TEAM Team name for the test series
--series SERIES Name of the test series (and optionally build number
'SERIES_NAME#BUILD_NUM' or build id
'SERIES_NAME#BUILD_ID')
--metadata NAME:VALUE
Adds given metadata to the test run. Expected format:
'NAME:VALUE'
Database connection:
--dbengine DB_ENGINE Database engine, postgresql or sqlite (default)
--database DATABASE database name
--host HOST database host name
--user USER database user
--pw PASSWORD, --password PASSWORD
database password
--port PORT database port (default: 5432)
--dont-require-ssl Disable the default behavior to require ssl from the
target database.
Schema updates:
--allow-minor-schema-updates
Allow TestArchiver to perform MINOR (backwards
compatible) schema updates the test archive
--allow-major-schema-updates
Allow TestArchiver to perform MAJOR (backwards
incompatible) schema updates the test archive
Clean history:
If any of the following options are used the archiver will delete the oldest
result data. What data is kept can be controlled with these --keep-X options
that can also be mixed. If deletion targets are not specified with --clean-X
options all test run data is cleaned. --keep-X options should be used when
using --clean-X options otherwise entire history is cleared.
--keep-builds KEEP_BUILDS
Delete old result data but keep the data for at least
given number of builds in each series.
--keep-months KEEP_MONTHS
Delete old result data but keep data that was archived
more recently than given number of months ago
--keep-after KEEP_AFTER
Delete old result data but keep data that was archived
more recently than given date in ISO 8601 format
yyyy-mm-dd.
--clean-team CLEAN_TEAM
Delete results only archived under given team name. Use
this with --keep-X options. Otherwise will delete
entire history
--clean-logs Delete oldest log messages but not test results or runs.
Use this with --keep-X options. Otherwise will delete
entire log history
--clean-logs-below {TRACE,DEBUG,INFO,WARN}
Delete oldest log messages that are bellow given log
level but not test results or runs. Use this with
--keep-X options. Otherwise will delete entire log
history
--clean-keyword-stats
Delete oldest keyword statistics data but not test
results or runs. Use this with --keep-X options.
Otherwise will delete entire log history
Limit archived data:
--no-keywords Do not archive keyword data
--no-keyword-stats Do not archive keyword statistics
--ignore-logs-below {TRACE,DEBUG,INFO,WARN}
Sets a cut off level for archived log messages. By
default archives all available log messages.
--ignore-logs Do not archive any log messages
--max_log_message_length MAX_LOG_MESSAGE_LENGTH
Specify how many characters of the log message that is
archived. full: archives the complete log. positive
integers: archives number of characters from the
beginning. negative integers: archives number of
characters from the end.
Adjust timestamps:
--time-adjust-secs TIME_ADJUST_SECS
Adjust time in timestamps by given seconds. This can
be used to change time to utc before writing the
results to database, especially if the test system
uses local time, such as robot framework. For example
if test were run in Finland (GMT+3) in summer (+1hr),
calculate total hours by minutes and seconds and
invert to adjust in correct direction, i.e.
-(3+1)*60*60, so --time-adjust-secs -14400. This
option is useful if you are archiving in a different
location to where tests are run.If you are running
tests and archiving in same timezone, time-adjust-
with-system-timezone may be a better option. This
option may be used in conjunction with --time-adjust-
with-system-timezone if desired.
--time-adjust-with-system-timezone
Adjust the time in timestamps by the system timezone
(including daylight savings adjust). If you are
archiving tests in the same timezone as you are
running tests, setting this option will ensure time
written to the database is in UTC/GMT time. This
assumes that if multiple computers are used that their
timezone and daylight savings settings are identical.
Take care also that you do not run tests just before a
daylight savings time adjust and archive just after,
as times will be out by one hour. This could easily
happen if long running tests cross a timezone adjust
boundary. This option may be used in conjunction with
--time-adjust-secs.
ChangeEngine:
--change-engine-url CHANGE_ENGINE_URL
Starts a listener that feeds results to ChangeEngine
--execution-context EXECUTION_CONTEXT
To separate data from different build pipelines for
ChangeEngine prioritization. Example if same changes
or tests may be used to verify app in Android and iOS
platforms, then it would be good to separate the
result from different builds pipelines/platforms. The
ChangeEngine prioritization might not give correct
result if different results from different platforms
are mixed together.
--changes CHANGES Json file which contains information from the changed
files for each repo. The file should be formatted like
this: { "context": "The execution context, same as
--execution-context and command line will override
this setting.", "changes": [ { "name": "string
representing the changed item, for example file path",
"repository": "Repository (optional), for separating
between changed items with identical names.",
"item_type": "Separating items (optional) and for
filtering subsets when prioritising", "subtype":
"(optional, for separating items for filtering subsets
when prioritising" } ] }
--execution-id EXECUTION_ID
Identifier or version of the tested application for
given execution-context. Stored in ChangeEngine and
returned by "last_update" query.
```
## Data model
[Schema and data model](https://github.com/salabs/TestArchiver/tree/master/test_archiver/schemas) (NOTICE: this points to latest version)
The schema is versioned and new versions of TestArchiver might require schema updates.
Mismatches with testarchiver version and database schema will cause parsing to fail.
TestArchiver can perform the required schema updates if `--allow-minor-schema-updates` or `--allow-major-schema-updates` flags are used.
Some updates require only minor updates that should be backwards compatible for tools reading the archived data.
Other updates are major and change the schema in backwards incompatible way.
Schema initialisation, schema updates and history cleaning can be run without parsing results using `testarchive_schematool` or the module directly `python3 -m test_archiver.database`.
## Useful metadata
There are meta data that are useful to add with the results. Some testing frameworks allow adding metadata to your test results and for those frameworks (e.g. Robot Framework) it is recommended to add that metadata already to the tests so the same information is also available in the results. Additional metadata can be added when parsing the results using the `--metadata` option. Metadata given during the parsing is linked to the top level test suite.
`--metadata NAME:VALUE`
## Test series and teams
In the data model, each test result file is represented as single test run. These test runs are linked and organized into builds in in different result series. Depending on the situation the series can be e.g. CI build jobs or different branches. By default if no series is specified the results are linked to a default series with autoincrementing build numbers. Different test runs (from different testing frameworks or parallel executions) that belong together can be organized into the same build. Different test series are additionally organized by team. Series name and build number/id are separated by `#`.
Some examples using the `--series` and `--team` options of `testarchiver`
- `--series ${JENKINS_JOB_NAME}#${BUILD_NUMBER}`
- `--series "UI tests"#<commit hash>`
- `--series ${CURRENT_BRANCH}#${BUILD_ID} --team Team-A`
- `--series manually_run`
Each build will have a build number in the series. If the build number is specified then that number is used. If the build number/id is omitted then the build number will be checked from the previous build in that series and incremented. If the build number/id is not a number it is considered a build identifier string. If that id is new to the series the build number is incremented just as if it no build number was specified. If the same build id is found in the same test series then the results are added under that same previously archived build.
If the tests are executed in a CI environment the build number/id is an excellent way to link the archived results to the actual builds.
The series can also be indicated using metadata. Any metadata with name prefixed with `series` are interpreted as series information. This is especially useful when using listeners. For example when using Robot Framework metadata `--metadata team:A-Team --metadata series:JENKINS_JOB_NAME#BUILD_NUMBER`
## Timestamp adjustment
Some test frameworks use local time in their timestamps. For archiving into databases this can be problematic if tests
are viewed and or run in different timezones. To address this two ways to adjust the time back to GMT/UTC are provided.
The first allows the user to apply an adjustment of a fixed time in seconds of their choosing. This is useful for cases
where tests were already run and the place/timezone where they were run are known. This option is useful if you are
archiving in a different location to where tests are run. The time value provided as an option is added to the
timestamp. Care must be taken with places where summer time is different (usually +1hr).
For example if test were run in Finland (GMT+2), plus 1 hour in summer, calculate total hours by minutes and seconds
and invert to adjust in correct direction, i.e. -(2+1)*60*60, so --time-adjust-secs -10800 in summer time,
and -7200 otherwise.
The second provides for automated adjustment based on the system timezone and/or daylight savings if it applies. This
is useful if the tests and archiving are performed in the same place and time.
This assumes that if multiple computers are used that their timezone and daylight savings settings are identical.
Care must also be taken that tests are not run just before a daylight savings time adjust and archived just after
as times will be out by one hour. This could easily happen if long running tests cross a timezone adjust boundary.
This can be set using --time-adjust-with-system-timezone.
The ArchiverRobotListener allows for the second option if its adjust_with_system_timezone argument is set to True.
To ensure any of the optional adjustments are traceable, two meta data values are added to the suites' test run.
If time-adjust-secs is set to a value, time_adjust_secs with that value is written to the suite_metadata table.
If `--time-adjust-with-system-timezone` option is included, then the addition of the time-adjust-secs and the
system timezone is written to the suite_metadata tables as time_adjust_secs_total.
e.g with command line
`output_parser.py --time-adjust-secs -3600 --time-adjust-with-system-timezone ...`
the following values would be added to suite_metadata table for (GMT+2)
- time_adjust_secs with value -3600
- time_adjust_secs_total with -10800.
This example is mimicking adding daylight savings (1hr = 3600 secs) onto
a system offset secs of 7200 (GMT+2). i.e. if the computer being used had the 'daylight savings' setting
of and you want to manually add it during archiving.
## Cleaning old data
Since version 3.0.0 there is support for cleaning/deleting oldest archived data. These options allow limiting the growth of the history with various options that control what types of data are cleaned and how long history is kept.
Different --keep-X and --clean-X options can be mixed to select what data is kept after cleaning.
In most cases --keep-X options are used when ever --clean-X options are used.
While history cleaning can be run with every results parsing update it is recomended to run cleaning operations separately.
Cleaning history can be run without parsing results using `testarchive_schematool` or the module directly `python3 -m test_archiver.database`.
Some examples
- `python3 -m test_archiver.database --keep-months 6`
Will delete all results older than 6 months
- `python3 -m test_archiver.database --keep-months 6 --clean-logs --clean-keyword-stats`
Only deletes logs and keywords statistics older than 6 months. Test results are not effected
- `python3 -m test_archiver.database --keep-builds 10 --keep-months 6`
Will delete all results older than 6 months but still keeping at least 10 last builds of each series
- `python3 -m test_archiver.database --lean-team Team-A`
Will delete all results archived under Team-A
- `python3 -m test_archiver.database --clean-logs`
Will delete all log log messages
# Release notes
- 3.0.0 (2023-05-11)
* Adds support for cleaning oldest test result data to delete in order to control the growth of test archives
* Major schema update #3:
- `call_index` column of `tree_hierarchy` table is converted from text to interger
- Adds `ON DELETE CASCADE` rule for `test_series_mapping` table to facilitate deletion of build records when their test result data is deleted
* Fixes error message in case of incompatible schema where schema is new then archiver
- 2.6.2 (2023-05-11)
* Fixes error message when newer schema used in archive than for archiver
* Python 3.6 support no longer tested
- 2.6.1 (2022-10-19)
* Fixes a bug/regression that caused data of log messages not to be archived.
- 2.6.0 (2022-09-15)
* `--max_log_message_length` option to control the length of log messages archived.
Defaults to 2000 chars. Negative values will archive log messages from the end.
* Ignores return statements without warnigns from Robot Framework 5.x inputs
- 2.5.1 (2022-09-06)
* JUnit parsers updated to accept results where time value is missing from a testcase
* XUnit parsers updated to accept results where time value is missing from a testcase
- 2.5.0 (2022-06-23)
* Time adjustments effect also test_run's generated field and start_time of all items
* Fixes pytest parser by always using keyword on failure
* The port option is now used when connecting to databases
- 2.4.0 (2021-04-28)
* Updates to support archiving Robot Framework 4.0
* Fixes bug in execution path calculation for log messages
- 2.3.0 (2021-03-16)
* Better support for feeding changes and execution context for ChangeEngine
- `--changes` for feeding changes information
- `--execution-id` Identifier or version of the tested application for given execution-context. Stored in ChangeEngine and returned by `last_update` query.
- 2.2.0 (2020-12-21)
* Ability to adjust times as reported by timestamps in test results.
- `--time-adjust-secs` allows for manual adjustment of the timestamps with given value
- `--time-adjust-with-system-timezone` allows for automatic adjustment of timestamps by timezone and/or daylight savings.
* Support for parsing PHPUnit output
* ChangeEngine:
- Listener ignores skipped tests
- Adds test type to all parsers
- `--execution-context` option for setting the execution context for the results
* diff2change_context_list.py now uses the term change context instead of simply context for clarity
* Adds Dockerfiles for an empty database and database with sample data
generated from project's tests
- 2.1.0 (2020-09-16)
* New options for controlling archiving of keywords and log messages
- `--no-keywords` for ignoring all keyword data
- `--no-keyword-stats` for not collecting keyword statistics data
- `--ignore-logs` for not collecting any log message data
- `--ignore-logs-below` for ignoring all log messages below the given log level
- 2.0.0 (2020-09-04)
* Distribution as pip package `pip3 install testarchiver` and it installs:
- `testarchiver` script (aka: output_parser.py)
- `testarchive_schematool` script (aka: database.py)
- `diff2change_context_list.py` script
- `test_archiver` module
* Functionality for managing schema updates
- TestArchiver version has to match with the schema version
- TestArchiver can apply schema updates when explicitly allowed
- Updates are divided to major and minor updates
- Minor updates are backwards compatible for applications reading the database
- Major updates are backwards incompatible for applications reading the database
* Major schema update #1:
- Adds `schema_updates` table for recording schema updates
- Adds `schema_version` column to `test_run` table to make schema incompatible with
old versions TestArchiver
- Adds index for log messages for query performance
* Renamed `output_parser.py` cli option `--change_engine_url` to `--change-engine-url`
* Record an execution path for test cases, suites and log messages.
- The path explains the position of the item in its test run.
- E.g. `s1-s2-t3` means the third test in the second subsuite of the top suite.
* Minor schema update #2:
- Adds `execution_path` column to `test_result`, `suite_result` and `log_message` tables
* Renamed Robot Framework listener `ArchiverListener.py` as `ArchiverRobotListener.py` for clarity
- 1.2.0 (2020-08-18)
* Important database integrity fix when using sqlite database
* Record test criticality (Robot Framework specific)
* Redesign of configurations management
- Allows using both config file and command line arguments uniformly
- CLI arguments override options set in config file
- 1.1.3 (2020-06-09)
* Performance fix for the schema existence check
* Improved error messages:
- Error when trying to archive results that have already been archived
- Error when psycopg2 module is not found
Raw data
{
"_id": null,
"home_page": "https://github.com/salabs/TestArchiver",
"name": "testarchiver",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.0",
"maintainer_email": "",
"keywords": "robotframework test report history",
"author": "Tommi Oinonen",
"author_email": "salabs-mail@siili.com",
"download_url": "https://files.pythonhosted.org/packages/62/ce/e2b09a91a1819a91574d742d39b4873dd94b793cb3b8bca1e97fbe81bea3/testarchiver-3.0.0.tar.gz",
"platform": null,
"description": "# TestArchiver\n\nTestArchiver is a tool for archiving your test results to a SQL database.\n\nAnd [Epimetheus](https://github.com/salabs/Epimetheus) is the tool for browsing the results you archived.\n\n## Testing framework support\n\n| Framework | Status | Fixture test status | Parser option |\n| --------------- | --------------------------- | ------------------- | ------------- |\n| Robot Framework | [Supported](robot_tests/) | Done | robot |\n| Mocha | [Supported](mocha_tests/) | Done | mocha-junit |\n| pytest | [Supported](pytest/) | Done | pytest-junit |\n| PHPUnit | [Supported](phpunit_tests/) | Done | php-junit |\n| JUnit | Experimental | Missing | junit |\n| xUnit | Experimental | Missing | xunit |\n| MSTest | Experimental | Missing | mstest |\n\n\nExperimental status here means that there is a parser that can take in e.g. generic JUnit formatted output but there is no specific test set or any extensive testing or active development for the parser.\n\nContributions for output parsers or listeners for different testing frameworks are appreciated. Contributing simply a fixture test set (that can be used to generate output files for developing a specific parser) is extremely helpful for any new framework.\n\n## Installation\n`sudo -H python3 -m pip install testarchiver`\n\n## Supported databases\n\n### SQLite\n\n[SQLite](https://www.sqlite.org) default database for the archiver and is mainly useful for testing and demo purposes. Sqlite3 driver is part of the python standard library so there are no additional dependencies for trying out the archiver.\n\n### PostgreSQL\n\n[PostgreSQL](https://www.postgresql.org) is the currently supported database for real projects. For example [Epimetheus](https://github.com/salabs/Epimetheus) service uses a PosrgreSQL database. For accessing PostgreSQL databases the script uses psycopg2 module: `pip install psycopg2-binary` (comes with pip install)\n\n## Basic usage\n\nThe output files from different testing frameworks can be parsed into a database using `test_archiver/output_parser.py` script.\n\n```\ntestarchiver --database test_archive.db output.xml\n```\n\nAssuming that `output.xml` is a output file generated by Robot Framework (the default parser option), this will create a SQLite database file named `test_archive.db` that contains the results.\n\nThe archiver script can also be invoked from the module:\n```\npython3 -m test_archiver.output_parser --database test_archive.db output.xml\n```\n\nFor list of other options: `testarchiver --help`\n```\npositional arguments:\n output_files list of test output files to parse in to the test\n archive\n\noptional arguments:\n -h, --help show this help message and exit\n --version, -v show program's version number and exit\n --config CONFIG_FILE Path to JSON config file containing database\n credentials and other configurations. Options given on\n command line will override options set in a config\n file.\n --format {robot,robotframework,xunit,junit,mocha-junit,pytest-junit,mstest,php-junit}\n output format (default: robotframework)\n --repository REPOSITORY\n The repository of the test cases. Used to\n differentiate between test with same name in different\n projects.\n --team TEAM Team name for the test series\n --series SERIES Name of the test series (and optionally build number\n 'SERIES_NAME#BUILD_NUM' or build id\n 'SERIES_NAME#BUILD_ID')\n --metadata NAME:VALUE\n Adds given metadata to the test run. Expected format:\n 'NAME:VALUE'\n\nDatabase connection:\n --dbengine DB_ENGINE Database engine, postgresql or sqlite (default)\n --database DATABASE database name\n --host HOST database host name\n --user USER database user\n --pw PASSWORD, --password PASSWORD\n database password\n --port PORT database port (default: 5432)\n --dont-require-ssl Disable the default behavior to require ssl from the\n target database.\n\nSchema updates:\n --allow-minor-schema-updates\n Allow TestArchiver to perform MINOR (backwards\n compatible) schema updates the test archive\n --allow-major-schema-updates\n Allow TestArchiver to perform MAJOR (backwards\n incompatible) schema updates the test archive\n\nClean history:\n If any of the following options are used the archiver will delete the oldest\n result data. What data is kept can be controlled with these --keep-X options\n that can also be mixed. If deletion targets are not specified with --clean-X\n options all test run data is cleaned. --keep-X options should be used when\n using --clean-X options otherwise entire history is cleared.\n\n --keep-builds KEEP_BUILDS\n Delete old result data but keep the data for at least\n given number of builds in each series.\n --keep-months KEEP_MONTHS\n Delete old result data but keep data that was archived\n more recently than given number of months ago\n --keep-after KEEP_AFTER\n Delete old result data but keep data that was archived\n more recently than given date in ISO 8601 format\n yyyy-mm-dd.\n --clean-team CLEAN_TEAM\n Delete results only archived under given team name. Use\n this with --keep-X options. Otherwise will delete\n entire history\n --clean-logs Delete oldest log messages but not test results or runs.\n Use this with --keep-X options. Otherwise will delete\n entire log history\n --clean-logs-below {TRACE,DEBUG,INFO,WARN}\n Delete oldest log messages that are bellow given log\n level but not test results or runs. Use this with\n --keep-X options. Otherwise will delete entire log\n history\n --clean-keyword-stats\n Delete oldest keyword statistics data but not test\n results or runs. Use this with --keep-X options.\n Otherwise will delete entire log history\n\nLimit archived data:\n --no-keywords Do not archive keyword data\n --no-keyword-stats Do not archive keyword statistics\n --ignore-logs-below {TRACE,DEBUG,INFO,WARN}\n Sets a cut off level for archived log messages. By\n default archives all available log messages.\n --ignore-logs Do not archive any log messages\n --max_log_message_length MAX_LOG_MESSAGE_LENGTH\n Specify how many characters of the log message that is\n archived. full: archives the complete log. positive\n integers: archives number of characters from the\n beginning. negative integers: archives number of\n characters from the end.\n\nAdjust timestamps:\n --time-adjust-secs TIME_ADJUST_SECS\n Adjust time in timestamps by given seconds. This can\n be used to change time to utc before writing the\n results to database, especially if the test system\n uses local time, such as robot framework. For example\n if test were run in Finland (GMT+3) in summer (+1hr),\n calculate total hours by minutes and seconds and\n invert to adjust in correct direction, i.e.\n -(3+1)*60*60, so --time-adjust-secs -14400. This\n option is useful if you are archiving in a different\n location to where tests are run.If you are running\n tests and archiving in same timezone, time-adjust-\n with-system-timezone may be a better option. This\n option may be used in conjunction with --time-adjust-\n with-system-timezone if desired.\n --time-adjust-with-system-timezone\n Adjust the time in timestamps by the system timezone\n (including daylight savings adjust). If you are\n archiving tests in the same timezone as you are\n running tests, setting this option will ensure time\n written to the database is in UTC/GMT time. This\n assumes that if multiple computers are used that their\n timezone and daylight savings settings are identical.\n Take care also that you do not run tests just before a\n daylight savings time adjust and archive just after,\n as times will be out by one hour. This could easily\n happen if long running tests cross a timezone adjust\n boundary. This option may be used in conjunction with\n --time-adjust-secs.\n\nChangeEngine:\n --change-engine-url CHANGE_ENGINE_URL\n Starts a listener that feeds results to ChangeEngine\n --execution-context EXECUTION_CONTEXT\n To separate data from different build pipelines for\n ChangeEngine prioritization. Example if same changes\n or tests may be used to verify app in Android and iOS\n platforms, then it would be good to separate the\n result from different builds pipelines/platforms. The\n ChangeEngine prioritization might not give correct\n result if different results from different platforms\n are mixed together.\n --changes CHANGES Json file which contains information from the changed\n files for each repo. The file should be formatted like\n this: { \"context\": \"The execution context, same as\n --execution-context and command line will override\n this setting.\", \"changes\": [ { \"name\": \"string\n representing the changed item, for example file path\",\n \"repository\": \"Repository (optional), for separating\n between changed items with identical names.\",\n \"item_type\": \"Separating items (optional) and for\n filtering subsets when prioritising\", \"subtype\":\n \"(optional, for separating items for filtering subsets\n when prioritising\" } ] }\n --execution-id EXECUTION_ID\n Identifier or version of the tested application for\n given execution-context. Stored in ChangeEngine and\n returned by \"last_update\" query.\n```\n\n## Data model\n\n[Schema and data model](https://github.com/salabs/TestArchiver/tree/master/test_archiver/schemas) (NOTICE: this points to latest version)\n\nThe schema is versioned and new versions of TestArchiver might require schema updates.\nMismatches with testarchiver version and database schema will cause parsing to fail.\nTestArchiver can perform the required schema updates if `--allow-minor-schema-updates` or `--allow-major-schema-updates` flags are used.\nSome updates require only minor updates that should be backwards compatible for tools reading the archived data.\nOther updates are major and change the schema in backwards incompatible way.\n\nSchema initialisation, schema updates and history cleaning can be run without parsing results using `testarchive_schematool` or the module directly `python3 -m test_archiver.database`.\n\n## Useful metadata\n\nThere are meta data that are useful to add with the results. Some testing frameworks allow adding metadata to your test results and for those frameworks (e.g. Robot Framework) it is recommended to add that metadata already to the tests so the same information is also available in the results. Additional metadata can be added when parsing the results using the `--metadata` option. Metadata given during the parsing is linked to the top level test suite.\n\n`--metadata NAME:VALUE`\n\n## Test series and teams\n\nIn the data model, each test result file is represented as single test run. These test runs are linked and organized into builds in in different result series. Depending on the situation the series can be e.g. CI build jobs or different branches. By default if no series is specified the results are linked to a default series with autoincrementing build numbers. Different test runs (from different testing frameworks or parallel executions) that belong together can be organized into the same build. Different test series are additionally organized by team. Series name and build number/id are separated by `#`.\n\nSome examples using the `--series` and `--team` options of `testarchiver`\n\n- `--series ${JENKINS_JOB_NAME}#${BUILD_NUMBER}`\n- `--series \"UI tests\"#<commit hash>`\n- `--series ${CURRENT_BRANCH}#${BUILD_ID} --team Team-A`\n- `--series manually_run`\n\nEach build will have a build number in the series. If the build number is specified then that number is used. If the build number/id is omitted then the build number will be checked from the previous build in that series and incremented. If the build number/id is not a number it is considered a build identifier string. If that id is new to the series the build number is incremented just as if it no build number was specified. If the same build id is found in the same test series then the results are added under that same previously archived build.\n\nIf the tests are executed in a CI environment the build number/id is an excellent way to link the archived results to the actual builds.\n\nThe series can also be indicated using metadata. Any metadata with name prefixed with `series` are interpreted as series information. This is especially useful when using listeners. For example when using Robot Framework metadata `--metadata team:A-Team --metadata series:JENKINS_JOB_NAME#BUILD_NUMBER`\n\n## Timestamp adjustment\n\nSome test frameworks use local time in their timestamps. For archiving into databases this can be problematic if tests\nare viewed and or run in different timezones. To address this two ways to adjust the time back to GMT/UTC are provided.\n\nThe first allows the user to apply an adjustment of a fixed time in seconds of their choosing. This is useful for cases\nwhere tests were already run and the place/timezone where they were run are known. This option is useful if you are\narchiving in a different location to where tests are run. The time value provided as an option is added to the\ntimestamp. Care must be taken with places where summer time is different (usually +1hr).\n\nFor example if test were run in Finland (GMT+2), plus 1 hour in summer, calculate total hours by minutes and seconds\nand invert to adjust in correct direction, i.e. -(2+1)*60*60, so --time-adjust-secs -10800 in summer time,\nand -7200 otherwise.\n\nThe second provides for automated adjustment based on the system timezone and/or daylight savings if it applies. This\nis useful if the tests and archiving are performed in the same place and time.\nThis assumes that if multiple computers are used that their timezone and daylight savings settings are identical.\nCare must also be taken that tests are not run just before a daylight savings time adjust and archived just after\nas times will be out by one hour. This could easily happen if long running tests cross a timezone adjust boundary.\nThis can be set using --time-adjust-with-system-timezone.\n\nThe ArchiverRobotListener allows for the second option if its adjust_with_system_timezone argument is set to True.\n\nTo ensure any of the optional adjustments are traceable, two meta data values are added to the suites' test run.\nIf time-adjust-secs is set to a value, time_adjust_secs with that value is written to the suite_metadata table.\nIf `--time-adjust-with-system-timezone` option is included, then the addition of the time-adjust-secs and the\nsystem timezone is written to the suite_metadata tables as time_adjust_secs_total.\n\ne.g with command line\n\n`output_parser.py --time-adjust-secs -3600 --time-adjust-with-system-timezone ...`\n\nthe following values would be added to suite_metadata table for (GMT+2)\n\n - time_adjust_secs with value -3600\n - time_adjust_secs_total with -10800.\n\nThis example is mimicking adding daylight savings (1hr = 3600 secs) onto\na system offset secs of 7200 (GMT+2). i.e. if the computer being used had the 'daylight savings' setting\nof and you want to manually add it during archiving.\n\n## Cleaning old data\nSince version 3.0.0 there is support for cleaning/deleting oldest archived data. These options allow limiting the growth of the history with various options that control what types of data are cleaned and how long history is kept.\nDifferent --keep-X and --clean-X options can be mixed to select what data is kept after cleaning.\nIn most cases --keep-X options are used when ever --clean-X options are used.\n\nWhile history cleaning can be run with every results parsing update it is recomended to run cleaning operations separately.\nCleaning history can be run without parsing results using `testarchive_schematool` or the module directly `python3 -m test_archiver.database`.\n\nSome examples\n- `python3 -m test_archiver.database --keep-months 6`\n Will delete all results older than 6 months\n- `python3 -m test_archiver.database --keep-months 6 --clean-logs --clean-keyword-stats`\n Only deletes logs and keywords statistics older than 6 months. Test results are not effected\n- `python3 -m test_archiver.database --keep-builds 10 --keep-months 6`\n Will delete all results older than 6 months but still keeping at least 10 last builds of each series\n- `python3 -m test_archiver.database --lean-team Team-A`\n Will delete all results archived under Team-A\n- `python3 -m test_archiver.database --clean-logs`\n Will delete all log log messages\n\n# Release notes\n- 3.0.0 (2023-05-11)\n * Adds support for cleaning oldest test result data to delete in order to control the growth of test archives\n * Major schema update #3:\n - `call_index` column of `tree_hierarchy` table is converted from text to interger\n - Adds `ON DELETE CASCADE` rule for `test_series_mapping` table to facilitate deletion of build records when their test result data is deleted\n * Fixes error message in case of incompatible schema where schema is new then archiver\n\n- 2.6.2 (2023-05-11)\n * Fixes error message when newer schema used in archive than for archiver\n * Python 3.6 support no longer tested\n\n- 2.6.1 (2022-10-19)\n * Fixes a bug/regression that caused data of log messages not to be archived.\n\n- 2.6.0 (2022-09-15)\n * `--max_log_message_length` option to control the length of log messages archived.\n Defaults to 2000 chars. Negative values will archive log messages from the end.\n * Ignores return statements without warnigns from Robot Framework 5.x inputs\n\n- 2.5.1 (2022-09-06)\n * JUnit parsers updated to accept results where time value is missing from a testcase\n * XUnit parsers updated to accept results where time value is missing from a testcase\n\n- 2.5.0 (2022-06-23)\n * Time adjustments effect also test_run's generated field and start_time of all items\n * Fixes pytest parser by always using keyword on failure\n * The port option is now used when connecting to databases\n\n- 2.4.0 (2021-04-28)\n * Updates to support archiving Robot Framework 4.0\n * Fixes bug in execution path calculation for log messages\n\n- 2.3.0 (2021-03-16)\n * Better support for feeding changes and execution context for ChangeEngine\n - `--changes` for feeding changes information\n - `--execution-id` Identifier or version of the tested application for given execution-context. Stored in ChangeEngine and returned by `last_update` query.\n\n- 2.2.0 (2020-12-21)\n * Ability to adjust times as reported by timestamps in test results.\n - `--time-adjust-secs` allows for manual adjustment of the timestamps with given value\n - `--time-adjust-with-system-timezone` allows for automatic adjustment of timestamps by timezone and/or daylight savings.\n * Support for parsing PHPUnit output\n * ChangeEngine:\n - Listener ignores skipped tests\n - Adds test type to all parsers\n - `--execution-context` option for setting the execution context for the results\n * diff2change_context_list.py now uses the term change context instead of simply context for clarity\n * Adds Dockerfiles for an empty database and database with sample data\n generated from project's tests\n\n- 2.1.0 (2020-09-16)\n * New options for controlling archiving of keywords and log messages\n - `--no-keywords` for ignoring all keyword data\n - `--no-keyword-stats` for not collecting keyword statistics data\n - `--ignore-logs` for not collecting any log message data\n - `--ignore-logs-below` for ignoring all log messages below the given log level\n\n- 2.0.0 (2020-09-04)\n * Distribution as pip package `pip3 install testarchiver` and it installs:\n - `testarchiver` script (aka: output_parser.py)\n - `testarchive_schematool` script (aka: database.py)\n - `diff2change_context_list.py` script\n - `test_archiver` module\n * Functionality for managing schema updates\n - TestArchiver version has to match with the schema version\n - TestArchiver can apply schema updates when explicitly allowed\n - Updates are divided to major and minor updates\n - Minor updates are backwards compatible for applications reading the database\n - Major updates are backwards incompatible for applications reading the database\n * Major schema update #1:\n - Adds `schema_updates` table for recording schema updates\n - Adds `schema_version` column to `test_run` table to make schema incompatible with\n old versions TestArchiver\n - Adds index for log messages for query performance\n * Renamed `output_parser.py` cli option `--change_engine_url` to `--change-engine-url`\n * Record an execution path for test cases, suites and log messages.\n - The path explains the position of the item in its test run.\n - E.g. `s1-s2-t3` means the third test in the second subsuite of the top suite.\n * Minor schema update #2:\n - Adds `execution_path` column to `test_result`, `suite_result` and `log_message` tables\n * Renamed Robot Framework listener `ArchiverListener.py` as `ArchiverRobotListener.py` for clarity\n\n- 1.2.0 (2020-08-18)\n * Important database integrity fix when using sqlite database\n * Record test criticality (Robot Framework specific)\n * Redesign of configurations management\n - Allows using both config file and command line arguments uniformly\n - CLI arguments override options set in config file\n\n- 1.1.3 (2020-06-09)\n * Performance fix for the schema existence check\n * Improved error messages:\n - Error when trying to archive results that have already been archived\n - Error when psycopg2 module is not found\n\n\n",
"bugtrack_url": null,
"license": "Apache License 2.0",
"summary": "Tools for serialising test results to SQL database",
"version": "3.0.0",
"project_urls": {
"Homepage": "https://github.com/salabs/TestArchiver"
},
"split_keywords": [
"robotframework",
"test",
"report",
"history"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "94990b97c1377de0eebd64766972ee71a665b4d7a41693dded3d0a98d9111ffb",
"md5": "369da08f1748c384f670a4c3891ac8cf",
"sha256": "5b2e72703ff3fc87912942ef7d990f197958a42c3e09ca778dce3d70f8caaf33"
},
"downloads": -1,
"filename": "testarchiver-3.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "369da08f1748c384f670a4c3891ac8cf",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.0",
"size": 47885,
"upload_time": "2023-05-11T15:12:52",
"upload_time_iso_8601": "2023-05-11T15:12:52.799751Z",
"url": "https://files.pythonhosted.org/packages/94/99/0b97c1377de0eebd64766972ee71a665b4d7a41693dded3d0a98d9111ffb/testarchiver-3.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "62cee2b09a91a1819a91574d742d39b4873dd94b793cb3b8bca1e97fbe81bea3",
"md5": "97a58ef3fa0ad1ec597d1e3d17a2efd0",
"sha256": "26d6caa36bc1894e99977092a05d1af71acb9df777e03a48363268a48e9db51d"
},
"downloads": -1,
"filename": "testarchiver-3.0.0.tar.gz",
"has_sig": false,
"md5_digest": "97a58ef3fa0ad1ec597d1e3d17a2efd0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.0",
"size": 49012,
"upload_time": "2023-05-11T15:12:54",
"upload_time_iso_8601": "2023-05-11T15:12:54.613911Z",
"url": "https://files.pythonhosted.org/packages/62/ce/e2b09a91a1819a91574d742d39b4873dd94b793cb3b8bca1e97fbe81bea3/testarchiver-3.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-05-11 15:12:54",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "salabs",
"github_project": "TestArchiver",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "testarchiver"
}