diff tests/test-run-tests.t @ 22044:a06172e85fd4

run-tests: add support for xunit test reports The Jenkins CI system understands xunit reports natively, so this will be helpful for anyone that wants to use Jenkins for testing hg or extensions that use run-tests.py for their testing.
author Augie Fackler <raf@durin42.com>
date Tue, 05 Aug 2014 21:17:11 -0400
parents 93c3b3f55d59
children 769198c6a62d
line wrap: on
line diff
--- a/tests/test-run-tests.t	Wed Aug 06 02:45:55 2014 -0500
+++ b/tests/test-run-tests.t	Tue Aug 05 21:17:11 2014 -0400
@@ -48,6 +48,39 @@
   # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
   python hash seed: * (glob)
   [1]
+test --xunit support
+  $ $TESTDIR/run-tests.py --with-hg=`which hg` --xunit=xunit.xml
+  
+  --- $TESTTMP/test-failure.t
+  +++ $TESTTMP/test-failure.t.err
+  @@ -1,4 +1,4 @@
+     $ echo babar
+  -  rataxes
+  +  babar
+   This is a noop statement so that
+   this test is still more bytes than success.
+  
+  ERROR: test-failure.t output changed
+  !.
+  Failed test-failure.t: output changed
+  # Ran 2 tests, 0 skipped, 0 warned, 1 failed.
+  python hash seed: * (glob)
+  [1]
+  $ cat xunit.xml
+  <?xml version="1.0" encoding="utf-8"?>
+  <testsuite errors="0" failures="1" name="run-tests" skipped="0" tests="2">
+    <testcase name="test-success.t" time="*"/> (glob)
+    <testcase name="test-failure.t" time="*"> (glob)
+  <![CDATA[--- $TESTTMP/test-failure.t
+  +++ $TESTTMP/test-failure.t.err
+  @@ -1,4 +1,4 @@
+     $ echo babar
+  -  rataxes
+  +  babar
+   This is a noop statement so that
+   this test is still more bytes than success.
+  ]]>  </testcase>
+  </testsuite>
 
 test for --retest
 ====================
@@ -291,6 +324,18 @@
   Skipped test-skip.t: irrelevant
   # Ran 1 tests, 2 skipped, 0 warned, 0 failed.
 
+Skips with xml
+  $ $TESTDIR/run-tests.py --with-hg=`which hg` --keyword xyzzy \
+  >  --xunit=xunit.xml
+  i.s
+  Skipped test-skip.t: irrelevant
+  # Ran 1 tests, 2 skipped, 0 warned, 0 failed.
+  $ cat xunit.xml
+  <?xml version="1.0" encoding="utf-8"?>
+  <testsuite errors="0" failures="0" name="run-tests" skipped="2" tests="1">
+    <testcase name="test-success.t" time="*"/> (glob)
+  </testsuite>
+
 Missing skips or blacklisted skips don't count as executed:
   $ echo test-failure.t > blacklist
   $ $TESTDIR/run-tests.py --with-hg=`which hg` --blacklist=blacklist \