Package: tm4j-reporter-api
Project summaryPackage providing TM4J Cloud REST API for test automation integration.InstallHow to buildpython setup.py sdistHow to install# PyPi
pip install tm4j-reporter-api
# Git
pip install git+https://github.com/Klika-Tech/tm4j_reporter_api.gitConfigureIn order to use TM4J Cloud REST API, you need to configure TM4J reporter withtm4j_api.configure_tm4j_apifunction first:fromtm4j_reporter_apiimporttm4j_apidefmy_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)ParamMandatoryDescriptionTypeExampleapi_access_keyYesAPI key to access TM4j. To get it seeInstructionstrproject_keyYesJira / TM4J project prefix without trailing dashstrQTUsageTest cycleYou 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 withtm4_api.create_test_cyclefunction:fromtm4j_reporter_apiimporttm4j_apidefmy_test_run_setup():tm4j_test_cycle_key=tm4j_api.create_test_cycle(test_cycle_name="My TM4J test cycle")returntm4j_test_cycle_keyParamMandatoryDescriptionTypeExampletest_cycle_nameYesName of your test cyclestrMy TM4J test cycledescriptionNoDescription of the test cycle outlining the scopestrSome feature test runplanned_start_dateNoPlanned start date of the test cycle. Format: yyyy-MM-dd'T'HH:mm:ss'Z'str2020-07-15'T'12:00:00'Z'planned_end_dateNoPlanned end date for the test cycle. Format: yyyy-MM-dd'T'HH:mm:ss'Z'str2020-07-15'T'12:30:00'Z'jira_project_versionNoID of the version from Jiraint1000status_nameNoName of a status configured for the projectstrDonefolder_idNoID of a folder to place the test cycle withinint10001owner_idNoAtlassian Account ID of the owner of the test cyclestr377441B7-835D-4B08-B7F4-219E9E62C015Test execution resultsWith 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 totm4j_api.create_test_execution_resultfunction:fromtm4j_reporter_apiimporttm4j_apidefmy_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)ParamMandatoryDescriptionTypeExampletest_cycle_keyYesKey of TM4J test cycle to put test execution tostrTIStest_case_keyYesKey of test case the execution applies tostrSA-T10execution_statusYesName of the Test Execution StatusstrPasstest_script_resultsNoList 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_dateNoDate test was executed. Format: yyyy-MM-dd'T'HH:mm:ss'Z'str2020-07-15'T'12:30:00'Z'environment_nameNoEnvironment assigned to the test casestrStagingexecution_timeNoActual execution time in millisecondsint121000executed_by_idNoAtlassian Account ID of the user who executes the teststr377441B7-835D-4B08-B7F4-219E9E62C015assigned_to_idNoAtlassian Account ID of the user assigned to the teststr377441B7-835D-4B08-B7F4-219E9E62C015commentNoComment against the overall test executionstrTest failed on step 2, check with Dev teamExceptionsTM4JConfigurationExceptionRaised bytm4j_api.configure_tm4j_apiandtm4j_api.create_test_execution_resultfunctions iftm4j_api.configure_tm4j_apifunction was not called before:tm4j_reporter_api.tm4j_exceptions.tm4j_configuration_exceptions.TM4JConfigurationException:YoumustconfigureTM4JreporterAPIbeforecallingTM4J,calltm4j_api.configure_tm4j_apimethodfirstTM4JResponseExceptionRaised bytm4j_api.configure_tm4j_apiandtm4j_api.create_test_execution_resultfunctions if TM4J Cloud responded with response status code different from201 Created:tm4j_reporter_api.tm4j_exceptions.tm4j_response_exceptions.TM4JResponseException:Responsestatuscode:400,responsemessage:BadRequest