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

Another issue with KeyError: 'custom_automation_id' #144

Closed igogo5yo closed 7 months ago

igogo5yo commented 1 year ago

TestRail CLI Version

1.5.0

CLI Environment

Mac 13.3.1 (M1 Chip), Python 3.11.3

TestRail Version

v7.8.0 Early Access (1141)

TestRail Instance Type

NA

Current behavior

I'm trying to upload the results:

<testsuites id="" name="" tests="23" failures="1" skipped="0" errors="0" time="94.28676699998975">
<testsuite name="tests/regression/CreateCampaign.smoke.spec.ts" timestamp="2023-05-05T16:25:44.331Z" hostname="smoke" tests="3" failures="0" skipped="0" time="28.659" errors="0">
<testcase name="Create campaign › Cannot create a campaign without providing a website" classname="tests/regression/CreateCampaign.smoke.spec.ts" time="4.841">
</testcase>
<testcase name="Create campaign › Submit basic form" classname="tests/regression/CreateCampaign.smoke.spec.ts" time="10.673">
</testcase>
<testcase name="Create campaign › Submit advanced form" classname="tests/regression/CreateCampaign.smoke.spec.ts" time="13.145">
</testcase>
</testsuite>
</testsuites>

and get the error:

Traceback (most recent call last):
  File "/opt/homebrew/bin/trcli", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/click/decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/trcli/commands/cmd_parse_junit.py", line 92, in cli
    result_uploader.upload_results()
  File "/opt/homebrew/lib/python3.11/site-packages/trcli/api/results_uploader.py", line 67, in upload_results
    missing_test_cases, error_message = self.api_request_handler.check_missing_test_cases_ids(
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/trcli/api/api_request_handler.py", line 291, in check_missing_test_cases_ids
    aut_case_id = case["custom_automation_id"]
                  ~~~~^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'custom_automation_id'

Desired behavior

No response

More Details

I have configured the automation_id field as it said in the documentation. Before I added the automation_id field I've seen the message:

Checking project. 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

After adding that filed I uploaded results successfully 1 time, then on the second try to upload results I get the error. Also, I've tried to delete and create again the automation_id field, but it didn't help.

HelpMeIAmLost commented 1 year ago

This also happens to me. I even tried updating the test suite name, and test case class name and name, to no avail. What works is deleting the section where the test case(s) created by the previous trcli execution are, then re-executing trcli.

mekapotulas commented 1 year ago

Facing the same issue

brentfoley commented 1 year ago

I am facing this issue as well (only difference from @igogo5yo is I'm on windows). Even if I use the example junit results example from the README, I get the same error as @igogo5yo .

My command: trcli -y -h <MYHOST> --project test --username <MYUSER> --password <MYPASSWORD> --verbose parse_junit --title "my automated test run" -f sample.xml

davidadale commented 11 months ago

Okay the key for me was to go back to the automation_id and down at the bottom assign it to a project. I gave it a default value of 1. Now it works fine.

d-rede commented 10 months ago

Hello and thanks for bringing this to our attention

If this worked at first, it is quite odd to fail a second time. The scenario where I might see this happening is when you have test cases which use a template to which the automation_id is not applied. Please make sure you have configured the field according to the image below (where it's Text, you may have String, that's not an issue). Let me know if this may be the case.

image

cozyloon commented 8 months ago

@igogo5yo were you able to fix the mentioned issue? I got the same issue as you mentioned after doing the same procedure. How did you fix it?

bitcoder commented 8 months ago

Closing this issue in the upcoming days if further feedback is not provided

bitcoder commented 7 months ago

closing due to lack of feedback