Skip to main content

python package providing functionality for Jira Test Management (tm4j) Cloud through REST API calls

Project description

Project summary

Package providing TM4J Cloud REST API for test automation integration.

Install

How to build

python setup.py sdist

How to install

# PyPi
pip install tm4j-reporter-api
# Git
pip install git+https://github.com/Klika-Tech/tm4j_reporter_api.git

Configure

In order to use TM4J Cloud REST API, you need to configure TM4J reporter with tm4j_api.configure_tm4j_api function first:

from tm4j_reporter_api import tm4j_api


def my_test_run_setup(my_access_key, my_project_key):

    tm4j_api.configure_tm4j_api(
        api_access_key=my_access_key,
        project_key=my_project_key
    )
Param Mandatory Description Type Example
api_access_key Yes API key to access TM4j. To get it see Instruction str
project_key Yes Jira / TM4J project prefix without trailing dash str QT

Usage

Test cycle

You need TM4J test cycle where to submit test execution results. You could create new TM4J test cycle in your test run setup in order to use its key for test execution results submitting with tm4_api.create_test_cycle function:

from tm4j_reporter_api import tm4j_api


def my_test_run_setup():

    tm4j_test_cycle_key = tm4j_api.create_test_cycle(
        test_cycle_name="My TM4J test cycle"    
    )

    return tm4j_test_cycle_key
Param Mandatory Description Type Example
test_cycle_name Yes Name of your test cycle str My TM4J test cycle
description No Description of the test cycle outlining the scope str Some feature test run
planned_start_date No Planned start date of the test cycle. Format: yyyy-MM-dd'T'HH:mm:ss'Z' str 2020-07-15'T'12:00:00'Z'
planned_end_date No Planned end date for the test cycle. Format: yyyy-MM-dd'T'HH:mm:ss'Z' str 2020-07-15'T'12:30:00'Z'
jira_project_version No ID of the version from Jira int 1000
status_name No Name of a status configured for the project str Done
folder_id No ID of a folder to place the test cycle within int 10001
owner_id No Atlassian Account ID of the owner of the test cycle str 377441B7-835D-4B08-B7F4-219E9E62C015

Test execution results

With TM4J test cycle key you can now submit test execution result. You also could use test cycle key of already existing TM4J test cycle if you want. Pass test cycle key and test execution results to tm4j_api.create_test_execution_result function:

from tm4j_reporter_api import tm4j_api

def my_test_teardown(tm4_test_cycle_key, tm4j_test_case_key, execution_status):

    tm4j_api.create_test_execution_result(
        test_cycle_key=tm4_test_cycle_key,
        test_case_key=tm4j_test_case_key,
        execution_status=execution_status    
    )
Param Mandatory Description Type Example
test_cycle_key Yes Key of TM4J test cycle to put test execution to str TIS
test_case_key Yes Key of test case the execution applies to str SA-T10
execution_status Yes Name of the Test Execution Status str Pass
test_script_results No List of objects with test steps results: statusName (str), actualEndDate (str, yyyy-MM-dd'T'HH:mm:ss'Z'), actualResult (str). Number of objects should match to steps number in TM4J test script. list [{"statusName": "Pass", "actualEndDate": "2020-07-15'T'12:30:00'Z'", "actualResult": "This step passed"}, {"statusName": "Fail", "actualEndDate": "2020-07-15'T'12:30:10'Z'", "actualResult": "This step failed"}]
actual_end_date No Date test was executed. Format: yyyy-MM-dd'T'HH:mm:ss'Z' str 2020-07-15'T'12:30:00'Z'
environment_name No Environment assigned to the test case str Staging
execution_time No Actual execution time in milliseconds int 121000
executed_by_id No Atlassian Account ID of the user who executes the test str 377441B7-835D-4B08-B7F4-219E9E62C015
assigned_to_id No Atlassian Account ID of the user assigned to the test str 377441B7-835D-4B08-B7F4-219E9E62C015
comment No Comment against the overall test execution str Test failed on step 2, check with Dev team

Exceptions

TM4JConfigurationException

Raised by tm4j_api.configure_tm4j_api and tm4j_api.create_test_execution_result functions if tm4j_api.configure_tm4j_api function was not called before:

tm4j_reporter_api.tm4j_exceptions.tm4j_configuration_exceptions.TM4JConfigurationException: You must configure TM4J reporter API before calling TM4J, call tm4j_api.configure_tm4j_api method first

TM4JResponseException

Raised by tm4j_api.configure_tm4j_api and tm4j_api.create_test_execution_result functions if TM4J Cloud responded with response status code different from 201 Created:

tm4j_reporter_api.tm4j_exceptions.tm4j_response_exceptions.TM4JResponseException: Response status code: 400, response message: Bad Request

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

tm4j-reporter-api-0.1.2.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

tm4j_reporter_api-0.1.2-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file tm4j-reporter-api-0.1.2.tar.gz.

File metadata

  • Download URL: tm4j-reporter-api-0.1.2.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for tm4j-reporter-api-0.1.2.tar.gz
Algorithm Hash digest
SHA256 e895f21bfe6f848e77f78ce669563e3c77c930f6954c425013287516f3027bcb
MD5 6b110da7150119526a381a11d9945ebe
BLAKE2b-256 9f467ba58b984e04a4a9f9e1626fa17bed535053db90966bb62373edd56c988c

See more details on using hashes here.

File details

Details for the file tm4j_reporter_api-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: tm4j_reporter_api-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for tm4j_reporter_api-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 14d1948b5b3d13e872a0d2247ca18946df4f98ab9e7ff50ce6eac09a955f8322
MD5 7a7eb0705e6bd9cda4b7519cda8cf439
BLAKE2b-256 58f2671b9583bb1f3550facf42f96c57e39e1e28db762c25e22a419ee0f942a8

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