lib/jazrb/jasmine/XMLReporter.js in smparkes-jazrb-0.0.9 vs lib/jazrb/jasmine/XMLReporter.js in smparkes-jazrb-0.0.10
- old
+ new
@@ -79,11 +79,11 @@
jasmine.XMLReporter.prototype.suites = function() {
return this.suites_;
};
jasmine.XMLReporter.prototype.summarize_ = function(suiteOrSpec) {
- var isSuite = suiteOrSpec instanceof jasmine.Suite
+ var isSuite = suiteOrSpec instanceof jasmine.Suite;
var summary = {
id: suiteOrSpec.id,
name: suiteOrSpec.description,
type: isSuite ? 'suite' : 'spec',
children: []
@@ -109,11 +109,11 @@
jasmine.XMLReporter.prototype.reportRunnerResults = function(runner) {
this.finished = true;
var results = runner.results();
var specs = runner.specs();
var specCount = specs.length;
- if(jasmine.XMLReporter.current_suite){
+ if(jasmine.XMLReporter.current_spec){
puts(" </testsuite>");
}
// puts(" <tests>"+specCount+"</tests>");
// puts(" <errors>"+results.failedCount+"</errors>");
// puts(" <skipped>0</skipped>");
@@ -126,9 +126,43 @@
jasmine.XMLReporter.prototype.reportSuiteResults = function(suite) {
};
//noinspection JSUnusedLocalSymbols
jasmine.XMLReporter.prototype.reportSpecResults = function(spec) {
+ var suite = spec.suite;
+ if(jasmine.XMLReporter.current_spec){
+ puts(" </testsuite>");
+ }
+ var name = [ spec.description ];
+ while(suite){
+ name.unshift( suite.description );
+ suite = suite.parentSuite;
+ }
+ puts(" <testsuite"+formatAttributes({name:name.join(" : ")}) +">");
+ jasmine.XMLReporter.current_spec = spec;
+ this.results_[spec.id] = {
+ spec: spec,
+ messages: spec.results().getItems(),
+ result: spec.results().failedCount > 0 ? "failed" : "passed"
+ };
+ var results = spec.results().getItems();
+ for(var i in results) {
+ var result = results[i];
+ puts(" <testcase"+formatAttributes({name:(1+parseInt(i))+ ": " + result.matcherName})+">");
+ if(!result.passed()){
+ puts(" <failure"+formatAttributes({type:result.matcherName,
+ message:result.message})+">");
+ puts("<![CDATA[");
+ puts(get_exception_trace(result.trace));
+ puts("]]>");
+ puts(" </failure>");
+ }
+ puts(" </testcase>");
+ }
+};
+
+//noinspection JSUnusedLocalSymbols
+jasmine.XMLReporter.prototype._reportSpecResults = function(spec) {
var suite = spec.suite;
if(jasmine.XMLReporter.current_suite != suite){
if(jasmine.XMLReporter.current_suite){
puts(" </testsuite>");
}