gurock / trcli

TR CLI (trcli) is a command line tool for interacting with TestRail.
Mozilla Public License 2.0
48 stars 39 forks source link

passing --run-id "###" causes a python parsing error #160

Closed joshuafontany closed 9 months ago

joshuafontany commented 10 months ago

TestRail CLI Version

1.6.0

CLI Environment

Windows 10, Python 3.11.3

TestRail Version

v 7.0.1.1013

TestRail Instance Type

Professional Server

Current behavior

I am uploading test results generated by an NUnit -> JUnit XML conversion. There are over 1K generated tests/cases/

If I do not pass a run-id to the command, it works fine. All unknown cases are discovered/added and then the results are pushed to a new run. If I include the --run-id "####", then I get python interpreter error:

  File "C:\Python311\Lib\site-packages\trcli\commands\cmd_parse_junit.py", line 36, in cli
    result_uploader.upload_results()
  File "C:\Python311\Lib\site-packages\trcli\api\results_uploader.py", line 119, in upload_results
    run, error_message = self.api_request_handler.update_run(
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\trcli\api\api_request_handler.py", line 412, in update_run
    run_tests: list = tests_response.response_text["tests"]
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
TypeError: list indices must be integers or slices, not str

Desired behavior

No response

More Details

It seems like the response from /index.php?/api/v2/get_tests/{run-id} is a list, not a object with a named "test" property.

bitcoder commented 9 months ago

Can you please verify the TestRail version you have, as that number doesn't seem accurate. Currently, TestRail is on version 8.0.x.

d-rede commented 9 months ago

Hi @joshuafontany

Thanks for bringing this to our attention! The issue should be resolved in the recently released trcli version 1.6.1. Please re-open this issue if this is not the case.

joshuafontany commented 9 months ago

Can you please verify the TestRail version you have, as that number doesn't seem accurate. Currently, TestRail is on version 8.0.x.

Ack, it truncated the "7", but you figured it out.

@bitcoder @d-rede You guys are great, testing this now!

joshuafontany commented 9 months ago

@bitcoder @d-rede Stable after multiple demos to the team(s). Thanks a lot guys. We are discussing upgrading to v8.