Project summary
Package providing Robot Framework listener for TM4J Cloud integration.
Install
How to build
python setup.py sdist
How to install
# PyPi
pip install tm4j-reporter-robot
# Git
pip install git+ssh://git@github.com:Klika-Tech/tm4j_reporter_robot.git
Usage
In order to use Robot Framework TM4J listener, it should be installed to the same PYTHONPATH as Robot Framework itself.
Listener requires arguments below to be passed:
| Param | Mandatory | Environment variable name | Description | Type | Example |
|---|---|---|---|---|---|
| tm4j_access_key | Yes | TM4J_ACCESS_KEY | API key to access TM4j. To get it see Instruction | str | |
| tm4j_project_key | Yes | TM4J_PROJECT_KEY | Jira / TM4J project prefix without trailing dash | str | QT |
| parallel_execution_flag | No | TM4J_PARALLEL_EXECUTION_SUPPORT | Flag to mark parallel execution. False by default | boolean | true |
| path_to_shared_test_cycle_key_file | No | TM4J_SHARED_TEST_CYCLE_KEY_FILE_PATH | Path to TM4J test cycle key shared file (used to handle parallel test execution). Deault value is {os_tempdir}/TEST_CYCLE_KEY |
str | /my_folder/my_test_cycle_key_file |
| tm4j_test_cycle_name | No | TM4J_TEST_CYCLE_NAME | TM4J test cycle name. If not passed, listener will create a new one test cycle with default name "Robot run YYYY-mm-DD HH-MM-SS" | str | My test cycle |
Listener will try to get attribute value from environment variables first, and if attribute is not set as environment variable - will look up to command line parameter.
Passing attributes from environment
You can set all or required only attributes as environment variables, so no need to pass them into command line:
export TM4J_ACCESS_KEY=<my_access_key>
export TM4J_PROJECT_KEY=QT
With that you can pass only non-required attributes to customize your test run:
pabot --processes 4 --listener tm4j_reporter_robot.TM4JRobotListener:::true:/my_user/temp/my_tc_key:"My custom test cycle name" tests/
If needed, you can set all arguments as environment variables, so command line will be simply short:
# setting the rest of variables
export TM4J_PARALLEL_EXECUTION_SUPPORT=true
export TM4J_SHARED_TEST_CYCLE_KEY_FILE_PATH=/my_user/temp/my_tc_key
export TM4J_TEST_CYCLE_NAME="My custom test cycle name"
# running tests
pabot --processes 4 --listener tm4j_reporter_robot.TM4JRobotListener tests/
Passing attributes from command line
While running Robot Framework, pass TM4JRobotListener as value for --listener argument, along with access and project keys:
robot --listener tm4j_reporter_robot.TM4JRobotListener:<tm4j_access_key>:<tm4j_project_key>:<parallel_execution_flag>:<path_to_shared_test_cycle_key_file>:<tm4j_test_cycle_name> test.robot
Example: running without parallel execution with custom test cycle name
robot --listener tm4j_reporter_robot.TM4JRobotListener:my_access_key:QT:::"My custom test cycle name" test.robot
Example: parallel execution with pabot and cleanup before run
rm -rf /my_user/temp/my_tc_key*
pabot --processes 4 --listener tm4j_reporter_robot.TM4JRobotListener:my_access_key:QT:true:/my_user/temp/my_tc_key:"My custom test cycle name" tests/
Tests preparation
In order to listener reported test execution to TM4J, mark Robot test case with tag TM4J:<tm4j_test_case_key>:
My Robot Test Case
[Tags] Some tag 1 Some tag 2 TM4J:QT-001
test code goes here
Parallel execution
For parallel execution with e.g. pabot, you need to set parallel execution flag to true.
Listener uses synchronization through shared file for test cycle key and lock file - so only one process \ thread will create TM4J test cycle for execution, write its key into a shared file, and all other processes \ threads read test cycle key from it.
Unfortunately, Robot API doesn't have any methods that called before or after ALL executions, so you need to delete shared test cycle key file and lock file manually after run. The best way is to create some pre-execution script (similar to example above) that will do this cleanup for you.
IMPORTANT: If you not delete those files, your next run will report test executions into previously created TM4J test cycle.
Exceptions
TM4JConfigurationException
Raised by listener if test is not tagged with TM4J test case key:
tm4j_reporter_api.tm4j_exceptions.tm4j_configuration_exceptions.TM4JConfigurationException: Test case key is not found in list of tags. Please mark robot test with tag 'TM4J:<test_case_key>'.
TM4J test cycle description keyword
Library provides possibility to set TM4J test cycle description with special keyword Set Tm4j Test Cycle Description.
Usage
Import library first, use keyword after:
*** Settings ***
Library tm4j_reporter_robot.TM4JCycleDescriptor
Suite Setup Setting Cycle Description
*** Keywords ***
Setting Cycle Description
Set Tm4j Test Cycle Description My test cycle description
Keyword is in global scope, so only one instance is created during the whole test execution and it is shared by all test cases and test suites.
Metadata
Release files for tm4j-reporter-robot 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tm4j-reporter-robot-0.1.4.tar.gz | 7.9 kB | Without provenance | Details for tm4j-reporter-robot-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tm4j_reporter_robot-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for tm4j_reporter_robot-0.1.4-py3-none-any.whl |
Total release size: 16.7 kB
Release files / tm4j-reporter-robot-0.1.4.tar.gz
| Download URL | tm4j-reporter-robot-0.1.4.tar.gz |
|---|---|
| Size | 7.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1929b6f41b14931e3746feb83647713028538d143bfb811f404ffcde66b7dc4f
|
|
BLAKE2b-256 checksum How to use checksums |
57eda8539620c631b705bc409e716947138d4ce7e256d1b26207f04567de2a30
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.9.1
|
Release files / tm4j_reporter_robot-0.1.4-py3-none-any.whl
| Download URL | tm4j_reporter_robot-0.1.4-py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d681307b8b99e54ce53ab790ff401fcbc38e10f21a3f282523741b1b8afd9967
|
|
BLAKE2b-256 checksum How to use checksums |
8e85099f429e308e204f5259a3e8bd3b429f7403a67b60754b76e96c0b4c9a95
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.9.1
|
Security for tm4j-reporter-robot 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.