Customize XML report files in Spock









up vote
1
down vote

favorite












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.










share|improve this question



























    up vote
    1
    down vote

    favorite












    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.










    share|improve this question

























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      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.










      share|improve this question















      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.







      jenkins groovy junit spock spock-reports






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 16 at 15:07

























      asked Nov 5 at 17:06









      Suo6613

      132112




      132112






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













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






          share|improve this answer




















          • 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 at 17:43










          • have you already checked out this readme? github.com/renatoathaydes/spock-reports/blob/master/README.md ? You have to configure a custom html report which creates your xml...
            – rdmueller
            Nov 15 at 6: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 at 20:46










          • do you have an example of the xml report you need?
            – rdmueller
            Nov 16 at 5:20










          • I just edited my question and added an example.
            – Suo6613
            Nov 16 at 15:07










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53158991%2fcustomize-xml-report-files-in-spock%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote













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






          share|improve this answer




















          • 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 at 17:43










          • have you already checked out this readme? github.com/renatoathaydes/spock-reports/blob/master/README.md ? You have to configure a custom html report which creates your xml...
            – rdmueller
            Nov 15 at 6: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 at 20:46










          • do you have an example of the xml report you need?
            – rdmueller
            Nov 16 at 5:20










          • I just edited my question and added an example.
            – Suo6613
            Nov 16 at 15:07














          up vote
          0
          down vote













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






          share|improve this answer




















          • 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 at 17:43










          • have you already checked out this readme? github.com/renatoathaydes/spock-reports/blob/master/README.md ? You have to configure a custom html report which creates your xml...
            – rdmueller
            Nov 15 at 6: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 at 20:46










          • do you have an example of the xml report you need?
            – rdmueller
            Nov 16 at 5:20










          • I just edited my question and added an example.
            – Suo6613
            Nov 16 at 15:07












          up vote
          0
          down vote










          up vote
          0
          down vote









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






          share|improve this answer












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







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 10 at 7:11









          rdmueller

          6,683748100




          6,683748100











          • 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 at 17:43










          • have you already checked out this readme? github.com/renatoathaydes/spock-reports/blob/master/README.md ? You have to configure a custom html report which creates your xml...
            – rdmueller
            Nov 15 at 6: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 at 20:46










          • do you have an example of the xml report you need?
            – rdmueller
            Nov 16 at 5:20










          • I just edited my question and added an example.
            – Suo6613
            Nov 16 at 15:07
















          • 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 at 17:43










          • have you already checked out this readme? github.com/renatoathaydes/spock-reports/blob/master/README.md ? You have to configure a custom html report which creates your xml...
            – rdmueller
            Nov 15 at 6: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 at 20:46










          • do you have an example of the xml report you need?
            – rdmueller
            Nov 16 at 5:20










          • I just edited my question and added an example.
            – Suo6613
            Nov 16 at 15:07















          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 at 17:43




          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 at 17:43












          have you already checked out this readme? github.com/renatoathaydes/spock-reports/blob/master/README.md ? You have to configure a custom html report which creates your xml...
          – rdmueller
          Nov 15 at 6:45




          have you already checked out this readme? github.com/renatoathaydes/spock-reports/blob/master/README.md ? You have to configure a custom html report which creates your xml...
          – rdmueller
          Nov 15 at 6: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 at 20:46




          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 at 20:46












          do you have an example of the xml report you need?
          – rdmueller
          Nov 16 at 5:20




          do you have an example of the xml report you need?
          – rdmueller
          Nov 16 at 5:20












          I just edited my question and added an example.
          – Suo6613
          Nov 16 at 15:07




          I just edited my question and added an example.
          – Suo6613
          Nov 16 at 15:07

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53158991%2fcustomize-xml-report-files-in-spock%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kleinkühnau

          Makov (Slowakei)

          Deutsches Schauspielhaus