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

Something wrong with report generated from robot-appiumlibrary=2.0.0 #201

Closed ElainaYW closed 4 months ago

ElainaYW commented 5 months ago

TestRail CLI Version

1.8.0

CLI Environment

macOS Sonoma 14.2, python 3.11.7

TestRail Version

8.0.3 Default (3066)

TestRail Instance Type

Professional Cloud

Current behavior

I ran the same robot file with the above two different environments (for the purpose of upgrading robotframework-appiumlibrary to 2.0.0), and the resulting output.xml was prepared for uploading the results to TestRail using trcli, and it gave the following error message, with the following initial thoughts. The preliminary idea is that the upgrade of the robotframework-appiumlibrary has caused a change in the format of the output.xml content, leading to the following error.

ps. Attached are the pip list and output.xml for two different environments. pip_list_version_b.txt pip_list_version_a.txt

 trcli -y \
 -h https://INSERT-INSTANCE-NAME.testrail.io \
 --project "Uto_AI" \
 --username INSERT-EMAIL \
 --password INSERT-PASSWORD \
 parse_robot \
 --title "elaina_test" \
 -f reports/output.xml

Use the above command to get the following result

TestRail CLI v1.8.0
Copyright 2023 Gurock Software GmbH - [www.gurock.com](http://www.gurock.com/)
Parser Results Execution Parameters
> Report file: /Users/elainaweng/elaina_workspace/app_regression/app_regression/reports/output.xml
> Config file: None
> TestRail instance: 
> Project: Uto_AI
> Run title: elaina_test
> Update run: No
> Add to milestone: No
> Auto-create entities: True
Parsing Robot Framework report.
Traceback (most recent call last):
  File "/opt/homebrew/Caskroom/miniconda/base/envs/elaina_appium2/bin/trcli", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/envs/elaina_appium2/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/envs/elaina_appium2/lib/python3.11/site-packages/trcli/cli.py", line 242, in main
    return super().main(windows_expand_args=False, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/envs/elaina_appium2/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/envs/elaina_appium2/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/envs/elaina_appium2/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/envs/elaina_appium2/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/envs/elaina_appium2/lib/python3.11/site-packages/trcli/commands/results_parser_helpers.py", line 101, in wrapper_common_options
    return f(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/envs/elaina_appium2/lib/python3.11/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/envs/elaina_appium2/lib/python3.11/site-packages/click/decorators.py", line 92, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/envs/elaina_appium2/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/envs/elaina_appium2/lib/python3.11/site-packages/trcli/commands/cmd_parse_robot.py", line 25, in cli
    parsed_suites = RobotParser(environment).parse_file()
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/envs/elaina_appium2/lib/python3.11/site-packages/trcli/readers/robot_xml.py", line 30, in parse_file
    self._find_suites(suite_element, sections_list)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/elaina_appium2/lib/python3.11/site-packages/trcli/readers/robot_xml.py", line 82, in _find_suites
    elapsed_time = self._parse_rf_time(status.get("endtime")) - self._parse_rf_time(status.get("starttime"))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/envs/elaina_appium2/lib/python3.11/site-packages/trcli/readers/robot_xml.py", line 125, in _parse_rf_time
    return datetime.strptime(time_str, '%Y%m%d %H:%M:%S.%f')
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: strptime() argument 1 must be str, not None

Desired behavior

No response

More Details

No response

bitcoder commented 4 months ago

RF 7.0 format is not supported or has been validated yet.. that is almost the reason for it. Can you please provide the original output.xml that worked and the newer one, which doesn't work?

Meanwhile, I advise you to run robot using the --legacy-output parameter

bitcoder commented 4 months ago

@ElainaYW can you please try out with this preliminary version? I tried it myself and it seems ok but I would appreciate if you could also try it.

trcli-1.9.0.tar.gz

The code is on this branch: https://github.com/gurock/trcli/tree/robot70

ElainaYW commented 4 months ago

Of course, thank you very much for your reply and the suggestion to attach a valid original output.xml and an invalid new output.xml! output.zip version_a_output.xml : robotframework=6.0.2 / robotframework-appiumlibrary=1.6 / trcli=1.6.3 version_b_output.xml : robotframework=7.0 / robotframework-appiumlibrary=2.0.0 / trcli=1.8.0

I am going to try trcli=1.9.0, how do I install it after downloading trcli-1.9.0.tar.gz?

bitcoder commented 4 months ago

@ElainaYW , itt should be something like this:

python -m pip uninstall trcli -y 
python -m pip install trcli-1.9.0.tar.gz
bitcoder commented 4 months ago

@ElainaYW any feedback?

bitcoder commented 4 months ago

closing as it was address by #204

ElainaYW commented 4 months ago

In trcli=1.9.0 can run successfully, thanks for your help.