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

Please add parsing "Elapsed" time to parse_robot command. #219

Closed smartuuu closed 3 months ago

smartuuu commented 3 months ago

What would you like the TestRail CLI to be able to do?

I'm using Robot Framework with trcli. I used to use parse_junit command to push test results to Testrail, and it was conveniently adding test elapsed time to the results. Now I'm using parse_robot command that allows me to attach screenshots in test results but I don't see elapsed time anymore. Not sure if it's a bug or missing functionality. Please add the ability to parse elapsed time wit parse_robot command. Thank you.

Why is this feature necessary on the TestRail CLI?

It works with parse_junit, but not with parse_robot.

More details

No response

Interested in implementing it yourself?

No

bitcoder commented 3 months ago
  1. Can you please share which version of Robot Framework you're using and the exact TRCLI version you're also using?
  2. Can you pls provide a sample RF output.xml with that elapsed info?
smartuuu commented 3 months ago

Robot Framework 6.1 (Python 3.11.1 on win32) TestRail CLI v1.9.4 The output.xml does not have the exact elapsed time info. I found only start and end time for the test. Where should I expect the info in the file? Basically the output.xml looks like the sample one: https://github.com/gurock/automation-frameworks-integration/blob/main/samples/robotframework/robotframework-selenium/sample_reports/output.xml

I cannot provide the full file due to sensitive data but this is the end of my output.xml file: image

bitcoder commented 3 months ago

@smartuuu can you please install and try out this version?

python -m pip uninstall trcli -y 
python3 -m pip install trcli-1.9.5.tar.gz

trcli-1.9.5.tar.gz

smartuuu commented 3 months ago

Installed the provided version and got the error: Parsing Robot Framework report. Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "C:\Users\**************\AppData\Local\Programs\Python\Python311\Scripts\trcli.exe\__main__.py", line 7, in <module> File "C:\Users\**************\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1157, in __call__ return self.main(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\**************\AppData\Local\Programs\Python\Python311\Lib\site-packages\trcli\cli.py", line 242, in main return super().main(windows_expand_args=False, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\**************\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1078, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "C:\Users\**************\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\**************\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1434, in invoke return ctx.invoke(self.callback, **ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\**************\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 783, in invoke return __callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\**************\AppData\Local\Programs\Python\Python311\Lib\site-packages\trcli\commands\results_parser_helpers.py", line 101, in wrapper_common_options return f(*args, **kwargs) ^^^^^^^^^^^^^^^^^^ File "C:\Users\**************\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\decorators.py", line 33, in new_func return f(get_current_context(), *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\**************\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\decorators.py", line 92, in new_func return ctx.invoke(f, obj, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\**************\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 783, in invoke return __callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\**************\AppData\Local\Programs\Python\Python311\Lib\site-packages\trcli\commands\cmd_parse_robot.py", line 25, in cli parsed_suites = RobotParser(environment).parse_file() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\**************\AppData\Local\Programs\Python\Python311\Lib\site-packages\trcli\readers\robot_xml.py", line 30, in parse_file self._find_suites(suite_element, sections_list) File "C:\Users\**************\AppData\Local\Programs\Python\Python311\Lib\site-packages\trcli\readers\robot_xml.py", line 128, in _find_suites self._find_suites(sub_suite_element, sections_list, namespace=namespace) File "C:\Users\**************\AppData\Local\Programs\Python\Python311\Lib\site-packages\trcli\readers\robot_xml.py", line 107, in _find_suites result = TestRailResult( ^^^^^^^^^^^^^^^ File "<string>", line 14, in __init__ File "C:\Users\**************\AppData\Local\Programs\Python\Python311\Lib\site-packages\trcli\data_classes\dataclass_testrail.py", line 51, in __post_init__ self.elapsed = self.proper_format_for_elapsed(self.elapsed) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\**************\AppData\Local\Programs\Python\Python311\Lib\site-packages\trcli\data_classes\dataclass_testrail.py", line 85, in proper_format_for_elapsed return f"{round(elapsed, 3)}s" if float(elapsed) >= 0.001 else None ^^^^^^^^^^^^^^^^^ TypeError: type str doesn't define __round__ method

bitcoder commented 3 months ago

@smartuuu can you please try this one? There was a condition missing

trcli-1.9.5.tar.gz

smartuuu commented 3 months ago

@bitcoder this one is perfect. The elapsed time was added. Thank you very much for the quick response!