devolo / adaptavist

python package providing functionality for Jira Test Management (tm4j)
MIT License
8 stars 11 forks source link

Adds compatibility with older tm4j API #39

Closed KanoB closed 1 year ago

KanoB commented 1 year ago

Older TM4J API do not have 'index' key in 'scriptResults' causing exceptions when sorting the list Function affected: get_test_results Related endpoint : /testrun/{test_run_key}/testresults

37

Shutgun commented 1 year ago

Hi @KanoB ,

thanks for your contribution. Could you tell me, which TM4J version you are using? If the index is missing: does the order of the results match the order of the steps?

KanoB commented 1 year ago

Hi @Shutgun, I can't see what version of TM4J is, since I am not admin on our JIRA instance. My thought is that it is v1 (https://support.smartbear.com/zephyr-scale-server/api-docs/v1/)

My test cases do not have steps, so I created one with steps and now I see that result does have the 'index' key inside scriptResults. It seems to me that the proposed change will be good for those test cases that do not have steps.

The problem I see now, is that if multipe results are within a test case, it add attachments to first execution and not last when using add_test_result_attachment() method.

KanoB commented 1 year ago

About add_test_results_attachment() issue that I mentioned above. I have proposed change, but I'm not fully aware of all implication

get_test_result() must be modified to retrieve the last execution results and not first one available.

I did the change and run the tests and all 36 passed. Let me know if you want me to push that in same PR.

Regards, Claudio

Shutgun commented 1 year ago

Supporting test cases without test steps is definitely something we should do. However, I feel like avoiding the sort completely then seems a better solution. Could you maybe post the payload of such a test case? Unfortunately I lost my access to a Jira instance with TM4J and I suppose you can post it quicker than my when asking my former colleges.

About the get_test_result method: I'd prefer a seperate PR for that :+1:

KanoB commented 1 year ago

Here's a sample payload of get_test_results(): payload

The test cycle information has 2 test cases, one with steps and the other one without it. When no steps are defined in test case, there is no index, because there's always only one element, so there is no need for sorting.

Shutgun commented 1 year ago

Do you want to take care about `add_test_results_attachment()? I would then put both into the same release.