1

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.

Suo6613
  • 431
  • 5
  • 17

1 Answers1

0

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...

rdmueller
  • 10,742
  • 10
  • 69
  • 126
  • Thanks - do you know where I can read a bit more on this? I cannot figure out how to override the default XML template! – Suo6613 Nov 14 '18 at 17:43
  • have you already checked out this readme? https://github.com/renatoathaydes/spock-reports/blob/master/README.md ? You have to configure a custom html report which creates your xml... – rdmueller Nov 15 '18 at 06:45
  • I have gone through this file but unfortunately I couldn't figure out how to get access to some fields like "start time" or "end time" of the execution of each feature! Like what I see in the JSON format report. – Suo6613 Nov 15 '18 at 20:46
  • do you have an example of the xml report you need? – rdmueller Nov 16 '18 at 05:20