繁体   English   中英

PySys的。 关于检索测试用例的执行信息以创建.CSV摘要文件(v 0.9.2)

[英]PySys. About retrieving testcases' execution info for creating a .CSV summary file (v 0.9.2)

我想创建一个输出文件(例如,.CSV文件),在该文件中存储从测试用例集执行获得的所有结果,除了结果本身,我还可以指定其他内容,例如测试用例标题,描述,执行日期/时间,测试用例持续时间等。

title, description, start datetime, duration (s), outcome
TC#1, My testcase #1, 2016/12/01 11:50:01, 64, BLOCKED 
TC#2, My testcase #2, 2016/12/01 11:52:23, 70, PASSED
TC#3, My testcase #3, 2016/12/01 11:53:45, 90, FAILED
...

有人做过吗?

任何对此的反馈将不胜感激。

问候

您可以在运行任务中使用-r选项运行,即pysys.py run -r(要查看所有选项的列表,请使用pysys.py run -h)。 -r选项可让您根据pysysproject.xml文件中定义的编写器记录测试的输出。 示例项目随附的文件定义如下:

<writers>
    <writer classname="XMLResultsWriter" module="pysys.writer" file="testsummary-%Y%m%d%H%M%S.xml">
        <!--
        Set properties on the XML test output writer class. The available properties that 
        can be set are the stylesheet location, whether to use file URLs in all references 
        to resources on the local disk, and the directory to write the output file (defaults 
        to the current working directory). Note that Mozilla Firefox requires the stylesheet
        to be located next to the XML file when loading the file, and all references to local
        resources must be as file URLs. Internet Explorer and Chrome can load the stylesheet
        from any location on the local disk, but cannot load resources when referenced by a
        file URL. 

        <property name="outputDir" value="${rootdir}"/>
        <property name="stylesheet" value="./pysys-log.xsl"/>
        <property name="useFileURL" value="true"/>
        -->
    </writer>   

    <!--
    Add in the test results writer if straight text output is required 

    <writer classname="TextResultsWriter" module="pysys.writer" file="testsummary-%Y%m%d%H%M%S.log">
        <property name="outputDir" value="${rootdir}"/>
    </writer>
    -->

    <!--
    Add in the JUnit results writer if output in the Apache Ant JUnit XML format is required. Use the 
    outputDir property to define the output directory for the JUnit test summary files (the writer will 
    produce one file per test into this output directory). If not specified this defaults to the current 
    working directory.

    <writer classname="JUnitXMLResultsWriter" module="pysys.writer">
        <property name="outputDir" value="${rootdir}/target/pysys-reports"/>
    </writer>
    -->
</writers>      

因此,在上面的示例中,您的测试输出将为xml。 您可以有多个编写器,即取消对TestResultsWriter的注释,并且您将同时具有xml和日志输出来总结测试结果。 我目前没有CSV输出编写器,尽管您可以编写自己的CSV输出编写器并配置pysysproject.xml文件以指向该文件(如果您希望我添加到核心软件包中,也请输入功能请求) 。 以pysys.writer包中的实现为例。

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM