简体   繁体   中英

Customize XML report files in Spock

I am new to Spock and need to figure out if I can customize the XML test report file generated by Spock. As far as I could figure out so far, I can enable generating JSON report file in which I would have access to all tests' start and end time.

I have integrated Spock with Jenkins and I am able to see the generated test reports after each build. I am wondering if there is a way by which I can customize this report to include start and end time?

Is there any way by which I can

  1. include my own defined parameters into the test results
  2. have Jenkins to show also my defined parameters in the report

Here is an example of what I want to have

<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="SpecName" tests="12" skipped="0" failures="2" errors="0" timestamp="2018-16-15T09:12:59" hostname="DESKTOP-VANP1TU" time="0.864">
    <properties/>
    <testcase name="FeatureName" classname="SpecName" time="0.116" startTime="2018-16-15T09:12:59" endTime="2018-16-15T09:12:59"/>
    .
    .
    .
</testsuite>

As you can see I have added two fields (StartTime and endTime) to the report.

the spock reports extension lets you define templates for your reports: https://github.com/renatoathaydes/spock-reports

with that at hand, you should also be able to define an XML template...

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.

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