views:

81

answers:

1

I'm extending RUnit (a unit testing suite for R) so that it produces also output that can be read by Hudson. actually I already have something that does this, but it does not handle 'deactivated' tests.

to see what I mean, have a look at the r-forge project 'rtest' (it temporarily identifies itself as RUnit, but it further works rather smoothly), and check the junitProtocol.r file

the problem is that I did not manage to find any definition of the schema accepted by Hudson and I did manage to convince a Java project to fail and error, so that its test suite would add a <failure/> and <error/> element inside of a few <testcase/> elements, but I did not manage to see what happens with a @Ignore @Test decoration.

many others have asked this same question, for example here too, but in the end one gets to this page which is a good starting point but is not complete. for example, it does not mention the <error/> element I discovered by trial and error.

I tried to read the source read by Hudson, but I did not find where to start.

any hints?

A: 

gave a closer look at the Hudson sources (in particular, CaseResult.java) I saw that including a <skipped/> element in a <testcase/> element is what I was looking for.

and just for future reference, the RELAX NG compact syntax of the schema I am producing (feel free to edit/maintain):

junit.rnc:
#----------------------------------------
start = testsuite

property = element property {
   attribute name {text},
   attribute value {text}
}

properties = element properties {
   property*
}

failure = element failure {
   attribute message {text},
   attribute type {text},
   text
}

error = element error {
   attribute message {text},
   attribute type {text},
   text
}

skipped = element skipped {
   text
}

testcase = element testcase {
   attribute classname {text},
   attribute name {text},
   attribute time {text},
   (failure|error)?,
   skipped?
}

testsuite = element testsuite {
   attribute errors {xsd:integer},
   attribute failures {xsd:integer},
   attribute hostname {text},
   attribute name {text},
   attribute tests {xsd:integer},
   attribute time {xsd:double},
   attribute timestamp {xsd:dateTime},
   properties,
   testcase*,
   element system-out {text},
   element system-err {text}
}
#----------------------------------------


and junitreport.rnc
#----------------------------------------
include "junit.rnc" {
   start = testsuites
   testsuite = element testsuite {
      attribute errors {xsd:integer},
      attribute failures {xsd:integer},
      attribute hostname {text},
      attribute name {text},
      attribute tests {xsd:integer},
      attribute time {xsd:double},
      attribute timestamp {xsd:dateTime},
      attribute id {text},
      attribute package {text},
      properties,
      testcase*,
      element system-out {text},
      element system-err {text}
   }
}

testsuites = element testsuites {
   testsuite*
}
#----------------------------------------
mariotomo