机器人框架output.xml文件中不存在starttime和endtime

问题描述 投票:0回答:1

我尝试使用 TestArchiver (

TestArchiver
) 将 Robot Framework 的测试结果解析为 postgres,但出现以下错误:

Parsing: 'output.xml'
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.12/bin/testarchiver", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/test_archiver/output_parser.py", line 861, in main
    build_number_cache = parse_xml(output_file, args.format, connection, config, build_number_cache)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/test_archiver/output_parser.py", line 795, in parse_xml
    parser.feed(buffer)
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/xml/sax/expatreader.py", line 211, in feed
    self._parser.Parse(data, isFinal)
  File "/Users/sysadmin/build/v3.12.0/Modules/pyexpat.c", line 416, in StartElement
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/xml/sax/expatreader.py", line 327, in start_element
    self._cont_handler.startElement(name, AttributesImpl(attrs))
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/test_archiver/output_parser.py", line 91, in startElement
    self.archiver.begin_status(attrs.getValue('status'), attrs.getValue('starttime'),
                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/xml/sax/xmlreader.py", line 291, in getValue
    return self._attrs[name]
           ~~~~~~~~~~~^^^^^^
KeyError: 'starttime'

我使用命令:

testarchiver --format robot --allow-major-schema-updates --dbengine postgresql --user postgres --pw ******* --database robot_test output.xml

我尝试查看

output.xml
,但也没有关键字开始时间和结束时间。

python xml automated-tests robotframework
1个回答
0
投票

问题的根源是Robot Framework的版本,我尝试将Robot Framework从7.0降级到6.0.1,问题已解决。

© www.soinside.com 2019 - 2024. All rights reserved.