我想要创建一个输出文件(例如,一个.CSV文件),在该文件上存储来自一个测试集执行的所有结果,在该文件中,除了结果本身之外,我还可以指定一些内容,例如testcase标题、描述、执行日期/时间、testcase持续时间等等.
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
...以前有人这样做过吗?
如对此有任何反馈,将不胜感激。
问候
发布于 2016-05-13 08:58:42
您可以使用-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输出编写器,尽管您可以编写自己的输出写入器,并将pysysproject.xml文件配置为指向这个值(如果您希望我添加到核心包中,也请输入一个特性请求)。作为示例查看pysys.writer包中的实现。
https://stackoverflow.com/questions/37205042
复制相似问题