shunit2
shunit2 copied to clipboard
jUnit XML-Like Output
Hello,
I would like to submit you a bunch of changes:
- adds a trick to prevent tested scripts to prematurely exit,
- fixes a typo in docbookPrep.sh,
- translates output report format to jUnit XML format,
- adds a command to run all test suites in a directory and optionally
write test reports to a specific directory (shunit2_testsuite),
- adds a command to join all test suite reports in a directory into a
single one report (shunit2_collect).
- adds a RPM specfile.
The API was not changed at all. And by default, reports are displayed to
stdout except if the SHUNIT_OUTPUTDIR is set. In that situation, the report
is saved to $SHUNIT_OUTPUTDIR/TEST-<test suite name>.xml, eg
/tmp/testsuites/reports/TEST-foo.xml for test suite foo.sh.
Please note, that due to network issues, I was not able to start coding
from the latest version (r294) but instead I started from the latest stable
release ie 2.1.5.
Nonetheless, I let you assess the pertinence of those changes and let you
pick whatever is needed to the project. Please help yourself!
Regards,
Frédéric MOULIN.
Original issue reported on code.google.com by [email protected]
on 23 Oct 2009 at 7:02
Attachments:
I would really like to get the xml format support into shunit2. What is needed
to get
this integrated into shunit? Make it optional? Allow to specify the output
style?
Original comment by [email protected]
on 8 Jan 2010 at 8:24
Currently the proposed patch is a partial rewrite of the existing code. It was
done
for a personal homework. So you have to understand that it is is not fully
tested,
and is rather intrusive: xml is the default format. Right now, I do not have
enough
time to update this code, but there should not be too much work to make the xml
output optional. Nonetheless, I am very interesting by a,y feedback. We keep in
touch! Thanks for your comment ;-)
Original comment by [email protected]
on 8 Jan 2010 at 8:43
Hi Frederic, thankyou for posting this patch. This is really useful.
Original comment by [email protected]
on 27 Aug 2010 at 12:37
Original comment by [email protected]
on 15 Mar 2011 at 12:30
- Added labels: Priority-Low, Type-Enhancement
- Removed labels: Priority-Medium, Type-Defect
the junit-xml patch works great! Now I'm merging Kate's new changes in to the
patched r294.
Original comment by [email protected]
on 24 May 2011 at 8:37
Ok, I've got a patch that updates 2.1.6 to include Frédéric Moulin's
JUnit-xml patch. Unfortunately it is not too clean - it reduces shunit2 to
only work with bash, and I've only been able to test it on Ubuntu and Redhat
linux flavours. With some more cleanup it can be made available. Contact me
for the dirty patch - however, I endavour to come up with a proper patch that
allows for both the junit-xml output and the normal shunit2 output.
In fact anyone else is in my position, I'm hooking the tests up to Atlassian
Bamboo's test reporting. So if that happens to be what you're doing, then I
suspect my dirty patch might be just the ticket for you!
Regards,
-Ben
Original comment by [email protected]
on 3 Jun 2011 at 5:54
Ben - Would like to get your patch for JUnit XML output in 2.1.6. Please post,
if possible. Much thanks!
Original comment by [email protected]
on 28 Sep 2011 at 8:58
Same here ! I would be really interested by the patched version with XML output.
Original comment by [email protected]
on 24 Oct 2011 at 1:35
Attached! There was quite a bit of tweaky stuff,
but in the end I did manage to merge 2.1.6 with the earlier work that
another fellow did to get junit-xml with an earlier version of shunt.
The patch is a bit messy, but it works great for us. We are now using
this approach with quite a few of our products.
Here's my diff command:
diff -u -r shunit2-2.1.6-orig shunit2-2.1.6 > shunit-2.1.6-xml.patch
Enjoy!
Original comment by [email protected]
on 31 Jan 2013 at 8:38
Attachments:
I'm sure it could be made to work without bash, but that was not in my
requirements so I took the shortcut and just used bash.
Original comment by [email protected]
on 1 Feb 2013 at 6:42
Here's a, so far working, non bash dependent, patched, version of shunit2:
https://github.com/s0undt3ch/shunit2
The regular output was kept, but can be omitted using SHUNIT_STDOUT.
There's an option to include the environment or not using SHUNIT_INCLUDE_ENV.
Original comment by [email protected]
on 3 Feb 2013 at 11:53
Could we get this patch included in the official shunit2 along with a new
release ?
Or is this project not supported anymore ?
Thank you
Original comment by [email protected]
on 29 Apr 2013 at 3:13
[deleted comment]
It seems that s0undt3ch is no longer supporting the XML patches
https://github.com/s0undt3ch/shunit2/pull/1
I have forked and fixed a couple of issues.
https://github.com/jeremycarroll/shunit2
My interest in the xml output is for integration with jenkins, and our
continuous test server.
Original comment by [email protected]
on 29 Apr 2013 at 8:49
Thanks. This is a good thing, I've been needing this for a while. We've had to
kludge JUnit XML output via a Perl script that runs with the end-of-suite hook.
Our goal is also to integrate with Jenkins.
Original comment by [email protected]
on 29 Apr 2013 at 9:56
Thank you very much !
My question about support was more related with the project in itself. Ideally
the fork should be merged back with the original shunit2 and released.
Thank you again, I will use it with Jenkins.
Barth
Original comment by [email protected]
on 30 Apr 2013 at 6:14
Hi Jeremy,
I have also started to correct the XML patches to make it work with jenkins. I
haven't had time to check your version, but you might want to check my patches,
some of them might be useful:
https://github.com/fekete-robert/shunit2/commits/jenkins
(I am not a programmer, so they might be ugly as hell.)
Regards,
Robert
Original comment by [email protected]
on 30 Apr 2013 at 7:34
Hi,
I think that we should change the line
cat << EOF >> "${SHUNIT_OUTPUTDIR}/TEST-${__shunit_suite_name}.xml"
into
cat << EOF > "${SHUNIT_OUTPUTDIR}/TEST-${__shunit_suite_name}.xml"
Appending only results in an invalid xml file.
Original comment by [email protected]
on 30 Apr 2013 at 11:54
Hi,
in the patch the functions oneTimeTearDown and oneTimeSetUp must not be piped.
That is important in order allow the called code to modify variables such as
the suite name.
Cheers,
Barth
Original comment by [email protected]
on 21 May 2013 at 12:15
Hey, i know it's been almost 5 years but i wanted to ask what the status if this issue is. Is there a way to get the patch integrated?
Also, i've seen there is a fork which already implements the feature: https://bitbucket.org/eddiewebb/shunit-with-reports
Regards!
Now that I have used this tool a bit more, I was kind hoping to have this feature available. I see that there have been attempts to get this done, but those are now outdated as their implementation is based on old version of this repo.
If there is still demand for this, I can try to give it a try.
@JussiPekonen, do you have a required patches for the latest version?
This or TAP would be quite nice. My motivation would be to allow github actions to report test results. I can open a new one for TAP format.
@ensonic, if you need JUnit XML output with timestamps support, you may use my repo with branch AJIOB/add-time-stamps, that stands in queue to create a PR (after the basic JUnit XML support adding).
Hi all,
Looks like we've merged the #176, so I think we can close this issue as completed.
Time measure support will be added by #180, but you can start using the current version.