I'd would like to create an output file (an .CSV file, as an example)on which store all the outcomes got from a testcase set execution, where I can specify things, besides the outcome itself, such us testcase title, description, execution date/time, testcase duration, etc...
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
...
Has anyone done this before?
Any feedback about it would be appreciated.
Regards
You can run with the -r option to the run task, ie pysys.py run -r (to see a list of all options use pysys.py run -h). The -r option allows you to record the output of the tests, based on the writers defined in the pysysproject.xml file. This file that comes with the example projects has the below defined;
<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>
So in the example above your test output would be in xml. You can have multiple writers, ie uncomment the TestResultsWriter and you will have both xml and log output summarizing the test results. I don't have a CSV output writer at the moment, though you can write your own one and configure your pysysproject.xml file to point to that (also please put in a feature request if you want me to add to the core package). Have a look at the implementations in the pysys.writer package as examples.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.