goss icon indicating copy to clipboard operation
goss copied to clipboard

Customize name attribute in Junit output report

Open aronneagu opened this issue 6 years ago • 1 comments

The following declaration generates the Junit xml report

file:
  /etc/hosts:
    exists: true
    mode: "0644"
    owner: root
    group: root
    filetype: file

This is the output from the Junit xml

<testsuite name="goss" errors="0" tests="5" failures="0" skipped="0" time="0.000" timestamp="2018-01-23T16:45:24Z">
<testcase name="File /etc/hosts exists" time="0.000">
<system-out>File: /etc/hosts: exists: matches expectation: [true]</system-out>
</testcase>
<testcase name="File /etc/hosts mode" time="0.000">
<system-out>File: /etc/hosts: mode: matches expectation: [&#34;0644&#34;]</system-out>
</testcase>
<testcase name="File /etc/hosts owner" time="0.000">
<system-out>File: /etc/hosts: owner: matches expectation: [&#34;root&#34;]</system-out>
</testcase>
<testcase name="File /etc/hosts group" time="0.000">
<system-out>File: /etc/hosts: group: matches expectation: [&#34;root&#34;]</system-out>
</testcase>
<testcase name="File /etc/hosts filetype" time="0.000">
<system-out>File: /etc/hosts: filetype: matches expectation: [&#34;file&#34;]</system-out>
</testcase>
</testsuite>

Would it be possible to customise the name="goss" attribute in the tag? The use case is that I am running goss tests against from jenkins against multiple servers, and because the name is set to goss its very difficult to differentiate on which server it actually failed. If I could replace goss with the hostname of the server where it was run, then it would much easier to identiyf and troubleshoot failing tests As you can see from below, I am checking openssh-version on several servers, but they give no hints where they were executed. screen shot 2018-01-23 at 16 51 51

aronneagu avatar Jan 23 '18 16:01 aronneagu

in my pipeline i use actually sh "sed -i 's/testsuite name=\"goss\"/testsuite name=\"${name}\"/' ${name}-junit.xml"

gimler avatar Nov 14 '18 20:11 gimler