muralikoppula / shunit2

Automatically exported from code.google.com/p/shunit2
0 stars 0 forks source link

jUnit XML-Like Output #16

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
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 mouli...@gmail.com on 23 Oct 2009 at 7:02

Attachments:

GoogleCodeExporter commented 8 years ago
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 mr.udan...@gmail.com on 8 Jan 2010 at 8:24

GoogleCodeExporter commented 8 years ago
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 mouli...@gmail.com on 8 Jan 2010 at 8:43

GoogleCodeExporter commented 8 years ago
Hi Frederic, thankyou for posting this patch. This is really useful.

Original comment by water...@gmail.com on 27 Aug 2010 at 12:37

GoogleCodeExporter commented 8 years ago

Original comment by kate.war...@gtempaccount.com on 15 Mar 2011 at 12:30

GoogleCodeExporter commented 8 years ago
the junit-xml patch works great! Now I'm merging Kate's new changes in to the 
patched r294.

Original comment by bdamm-ac...@dammfine.com on 24 May 2011 at 8:37

GoogleCodeExporter commented 8 years ago
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 bdamm-ac...@dammfine.com on 3 Jun 2011 at 5:54

GoogleCodeExporter commented 8 years ago
Ben - Would like to get your patch for JUnit XML output in 2.1.6.  Please post, 
if possible.  Much thanks!

Original comment by 88jwil...@gmail.com on 28 Sep 2011 at 8:58

GoogleCodeExporter commented 8 years ago
Same here ! I would be really interested by the patched version with XML output.

Original comment by marc.pou...@gmail.com on 24 Oct 2011 at 1:35

GoogleCodeExporter commented 8 years ago
This hasn't been merged yet?

Original comment by pe...@algarvio.me on 31 Jan 2013 at 3:28

GoogleCodeExporter commented 8 years ago
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 benjamin...@gmail.com on 31 Jan 2013 at 8:38

Attachments:

GoogleCodeExporter commented 8 years ago
Bummer! Only bash?! That not good :\

Original comment by pe...@algarvio.me on 1 Feb 2013 at 9:14

GoogleCodeExporter commented 8 years ago
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 benjamin...@gmail.com on 1 Feb 2013 at 6:42

GoogleCodeExporter commented 8 years ago
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 pe...@algarvio.me on 3 Feb 2013 at 11:53

GoogleCodeExporter commented 8 years ago
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 barthele...@gmail.com on 29 Apr 2013 at 3:13

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
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 j...@syapse.com on 29 Apr 2013 at 8:49

GoogleCodeExporter commented 8 years ago
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 88jwil...@gmail.com on 29 Apr 2013 at 9:56

GoogleCodeExporter commented 8 years ago
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 barthele...@gmail.com on 30 Apr 2013 at 6:14

GoogleCodeExporter commented 8 years ago
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 fekete77...@gmail.com on 30 Apr 2013 at 7:34

GoogleCodeExporter commented 8 years ago
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 barthele...@gmail.com on 30 Apr 2013 at 11:54

GoogleCodeExporter commented 8 years ago
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 barthele...@gmail.com on 21 May 2013 at 12:15