簡體   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