gurock / trcli

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

KeyError: 'custom_automation_id' #97

Closed breadberry-prime closed 1 year ago

breadberry-prime commented 2 years ago

TestRail CLI Version

1.3.0

CLI Environment

3.10.6, MacBookPro

TestRail Version

v7.5.4

TestRail Instance Type

Enterprise Cloud

Current behavior

While trying to upload an auto generated Cypress report the library crashes with 'KeyError: 'custom_automation_id'

Stack: Traceback (most recent call last): File "/usr/local/bin/trcli", line 8, in <module> sys.exit(cli()) File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1130, in __call__ return self.main(*args, **kwargs) File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1055, in main rv = self.invoke(ctx) File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/local/lib/python3.10/site-packages/click/core.py", line 760, in invoke return __callback(*args, **kwargs) File "/usr/local/lib/python3.10/site-packages/click/decorators.py", line 26, in new_func return f(get_current_context(), *args, **kwargs) File "/usr/local/lib/python3.10/site-packages/click/decorators.py", line 84, in new_func return ctx.invoke(f, obj, *args, **kwargs) File "/usr/local/lib/python3.10/site-packages/click/core.py", line 760, in invoke return __callback(*args, **kwargs) File "/usr/local/lib/python3.10/site-packages/trcli/commands/cmd_parse_junit.py", line 46, in cli result_uploader.upload_results() File "/usr/local/lib/python3.10/site-packages/trcli/api/results_uploader.py", line 92, in upload_results added_test_cases, result_code = self.add_missing_test_cases( File "/usr/local/lib/python3.10/site-packages/trcli/api/results_uploader.py", line 288, in add_missing_test_cases ) = self.api_request_handler.check_missing_test_cases_ids(project_id) File "/usr/local/lib/python3.10/site-packages/trcli/api/api_request_handler.py", line 296, in check_missing_test_cases_ids aut_case_id = case["custom_automation_id"] KeyError: 'custom_automation_id'

This is the cypress Report I used: TEST-091622.xml.zip

Desired behavior

I would expect that I get a useful error message if the data is wrongly formatted.

More Details

No response

IPrototypeI commented 1 year ago

Hello I had the same issue you have to apply the custom id to all of your projects in testrail you can check if it works via the API https://ebike.testrail.net/index.php?/api/v2/get_cases/41&offset=250 use in postman basic authentification to use username and password

sbhandari40942 commented 1 year ago

does anyone has any update on this bug. I am not able to find any workaround

IPrototypeI commented 1 year ago

Yes the problem is it is not enough to add a single property to the template you have to apply the property to your project otherwise it is not working and the change is not active on testrail

d-rede commented 1 year ago

Hello @breadberry-prime , @sbhandari40942 , @IPrototypeI

This should no longer be a problem in trcli v1.4.0. Please give it a try and let me know if it works as you expect it to, thanks!

vui-le-hpe commented 1 year ago

I can confirm that it works for me in trcli v1.4.2. Earlier I got the following error when trying to run parse_junit:

...
The automation_id field is not properly configured. Please configure it in the TestRail Administration under Customizations > Case Fields.
The field should have the following mandatory details:
  - System Name: automation_id
  - Type: String
  - Is Active: True

I added the field automation_id to Case Fields. It worked after that.

d-rede commented 1 year ago

Thanks for the feedback @vui-le-hpe !

I will close this issue and a new one can be created in case anyone is running into a similar problem.