简体   繁体   English

Allure 无法读取由机器人框架中的 AllureReportLibrary 生成的 output.xml 文件

[英]Allure not able to read output.xml file generated by AllureReportLibrary in Robot Framework

I am using Ride (RobotFramework IDE) and I have imported Library AllureReportLibrary in my project.我正在使用 Ride(RobotFramework IDE),并且在我的项目中导入了 Library AllureReportLibrary Using the Set Output Dir , I am creating a Directory C:/AutomationLogs/Allure and all the allure properties and xml files are getting generated in that path.使用Set Output Dir ,我正在创建一个目录C:/AutomationLogs/Allure并且所有的诱惑属性和 xml 文件都在该路径中生成。

Set Output Dir   C:/AutomationLogs/

Then I am using the "allure serve C:\\AutomationLogs\\Allure" command to try and generate the html report file in command prompt, but it shows the below error -然后我使用“allure serve C:\\AutomationLogs\\Allure”命令尝试在命令提示符下生成html报告文件,但它显示以下错误 -

"Could not read result C:\\AutomationLogs\\Allure\\f56f4796-d30a-47f3-a988-d17f6c4e13ca-testsuite.xml: {} com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize va lue of type ru.yandex.qatools.allure.model.SeverityLevel from String "None": value not one of declared Enum instance names: [trivial, blocker, minor, normal, critical]" “无法读取结果 C:\\AutomationLogs\\Allure\\f56f4796-d30a-47f3-a988-d17f6c4e13ca-testsuite.xml: {} com.fasterxml.jackson.databind.exc.InvalidFormatException: 无法反序列化类型为ru.yandex.qatools.allure.model.SeverityLevel来自字符串“None”:值不是声明的 Enum 实例名称之一:[trivial、blocker、minor、normal、critical]”

The xml file " f56f4796-d30a-47f3-a988-d17f6c4e13ca-testsuite.xml " was generated using the AllureReportLibrary xml 文件“ f56f4796-d30a-47f3-a988-d17f6c4e13ca-testsuite.xml ”是使用 AllureReportLibrary 生成的

Also the index.html file which is generated after the command opens after this command and shows Allure Report unknown unknown - unknown (Unknown) 0 test cases NaN%还有 index.html 文件,它在此命令后打开命令后生成,并显示 Allure Report unknown unknown - unknown (Unknown) 0 test cases NaN%

I am using the below - Allure version - 2.4.1我正在使用以下 - Allure 版本 - 2.4.1

Ride version - RIDE 1.5.2.1 running on Python 2.7.12. Ride 版本 - 在 Python 2.7.12 上运行的 RIDE 1.5.2.1。

I am new to Robot Framework and Allure.我是 Robot Framework 和 Allure 的新手。 Please let me know whether I have implemented it correctly and why I am facing the above error.请让我知道我是否正确实施了它以及为什么我面临上述错误。

-Ryan M -瑞安 M

I'm using the 1.1.1 version of Allure Adaptor for Robot Framework and the severity is picked from the test case tags and added as a label under the test-case element of the report.我正在使用1.1.1版本的 Allure Adapter for Robot Framework,严重性是从测试用例标签中挑选出来的,并作为标签添加到报告的test-case元素下。

However, it seems that Allure 2.6.0 is also expecting a valid value for the severity attribute of the test-case element.但是,似乎 Allure 2.6.0也期待test-case元素的severity属性的有效值。

In order to use Allure2 with the current reports I have altered AllureListener.py to also add the severity to the test case:为了在当前报告中使用 Allure2,我更改了AllureListener.py以将严重性添加到测试用例中:

elif tag in SEVERITIES:
    test.severity = tag
    test.labels.append(TestLabel(
        name='severity',
        value=tag
    ))

If your output.xml has severity = None for any testcase then the allure-robotframework-adaptor will give the error that you have mentioned.如果您的 output.xml 对于任何测试用例都具有severity = None那么 allure-robotframework-adaptor 将给出您提到的错误。 Creating TestCase() object with severity='' in start_suitesetup method of AllureListener.py will do the trick.创建TestCase()与对象severity=''start_suitesetup的方法AllureListener.py将达到目的。

def start_suitesetup(self, name, attributes):
    ....
    ....
    test = TestCase(name=name,
                    description=description,
                    start=now(),
                    attachments=[],
                    labels=[],
                    parameters=[],
                    steps=[],
                    severity='')

How to create the Allure reports in Robot Framework ?如何在 Robot Framework 中创建 Allure 报告?

Initially, Download the Command line and UNzip the file and save the path of the bin folder in environment.最初,下载命令行并解压缩文件并将 bin 文件夹的路径保存在环境中。

Link : http://repo.maven.apache.org/maven2/io/qameta/allure/allure-commandline/2.8.0/allure-commandline-2.8.0.zip链接: http : //repo.maven.apache.org/maven2/io/qameta/allure/allure-commandline/2.8.0/allure-commandline-2.8.0.zip

Unzip the above file then put it in the Environment folder.解压上述文件,然后将其放入 Environment 文件夹中。

Then Pip install the below modules然后 Pip 安装以下模块

  1. pip install allure-robotframework pip install allure-robotframework
  2. pip install robotframework-allurereport pip安装robotframework-allurereport

In robot file, Add the Library in Settings like, Example :在机器人文件中,在设置中添加库,例如,示例:

Library AllureReportLibrary D:\\eclipse\\RobotFramework\\results库 AllureReportLibrary D:\\eclipse\\RobotFramework\\results

Then Use the Below commands to run the robot code.然后使用以下命令运行机器人代码。

robot --listener allure_robotframework;D:\\eclipse\\RobotFramework\\results Example.txt机器人 --listener allure_robotframework;D:\\eclipse\\RobotFramework\\results Example.txt

Finally,最后,

Generate the HTML file by,生成 HTML 文件,

allure generate D:\\eclipse\\RobotFramework\\results诱惑生成 D:\\eclipse\\RobotFramework\\results

Note : Use the same path what you used in the previous command to generate the HTml.file.注意:使用您在上一个命令中使用的相同路径来生成 HTml.file。 and Open in Mozhila FireFox.并在 Mozhila FireFox 中打开。 It wont be work in Chrome.它不会在 Chrome 中工作。 I dont know exactly why.我不知道究竟是为什么。

Regards,问候,

Vijay维杰

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 机器人框架中的output.xml文件是如何生成的 - How is the output.xml file generated in robot framework 如何从 Robot Framework 输出更改 output.xml 的结构 - How to change the structure of output.xml from Robot Framework output 在 Robot Framework 中的 Suite Teardown 之前解析 output.xml - Parse output.xml before Suite Teardown in Robot Framework 如何在log.html和output.xml中向ROBOT Framework测试统计信息添加一些外部链接? - How to add some external links to ROBOT Framework Test Statistics in log.html and output.xml? 有没有办法在机器人框架中测试完成后在电子邮件中发送log.html,report.html和output.xml? - Is there a way to send log.html,report.html and output.xml in email after test completion in robot-framework? 读取和更新 XML 中的字母数字值并生成新的 output.xml 文件时出现问题 - Issue while reading and updating an alphanumeric value in XML and generating new output.xml file 解析机器人框架的输出xml - Parse Robot Framework's output xml 如何为机器人框架安装/设置 Allure Reporting? - How to install/setup Allure Reporting for robot framework? Robot Framework:如何将控制台输出重定向到文件 - Robot Framework: How to redirect console output to file 如何使用python(机器人框架)将.properties文件中的数据读取到.robot文件中 - how to read data from .properties file into .robot file using python(robot framework)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM