Commit 38d27611 38d276119c4125b174d78048907c7a1aaa0cfb7e by Nicolas Perriault

updated xunit tests to refect use of getSerializedXML

1 parent 113258a9
...@@ -159,6 +159,7 @@ XUnitExporter.prototype.getXML = function getXML() { ...@@ -159,6 +159,7 @@ XUnitExporter.prototype.getXML = function getXML() {
159 * @return string 159 * @return string
160 */ 160 */
161 XUnitExporter.prototype.getSerializedXML = function getSerializedXML(xml) { 161 XUnitExporter.prototype.getSerializedXML = function getSerializedXML(xml) {
162 "use strict";
162 var serializer = new XMLSerializer(); 163 var serializer = new XMLSerializer();
163 return '<?xml version="1.0" encoding="UTF-8"?>' + serializer.serializeToString(this.getXML()); 164 return '<?xml version="1.0" encoding="UTF-8"?>' + serializer.serializeToString(this.getXML());
164 } 165 }
......
...@@ -7,7 +7,7 @@ casper.test.begin('XUnitReporter() initialization', 1, function suite(test) { ...@@ -7,7 +7,7 @@ casper.test.begin('XUnitReporter() initialization', 1, function suite(test) {
7 var xunit = require('xunit').create(); 7 var xunit = require('xunit').create();
8 var results = new tester.TestSuiteResult(); 8 var results = new tester.TestSuiteResult();
9 xunit.setResults(results); 9 xunit.setResults(results);
10 test.assertTruthy(xunit.getXML()); 10 test.assertTruthy(xunit.getSerializedXML());
11 test.done(); 11 test.done();
12 }); 12 });
13 13
...@@ -25,7 +25,7 @@ casper.test.begin('XUnitReporter() can hold test suites', 4, function suite(test ...@@ -25,7 +25,7 @@ casper.test.begin('XUnitReporter() can hold test suites', 4, function suite(test
25 }); 25 });
26 results.push(suite2); 26 results.push(suite2);
27 xunit.setResults(results); 27 xunit.setResults(results);
28 casper.start().setContent(xunit.getXML()); 28 casper.start().setContent(xunit.getSerializedXML());
29 test.assertEvalEquals(function() { 29 test.assertEvalEquals(function() {
30 return __utils__.findAll('testsuite').length; 30 return __utils__.findAll('testsuite').length;
31 }, 2); 31 }, 2);
...@@ -50,7 +50,7 @@ casper.test.begin('XUnitReporter() can hold a suite with a succesful test', 1, f ...@@ -50,7 +50,7 @@ casper.test.begin('XUnitReporter() can hold a suite with a succesful test', 1, f
50 }); 50 });
51 results.push(suite1); 51 results.push(suite1);
52 xunit.setResults(results); 52 xunit.setResults(results);
53 casper.start().setContent(xunit.getXML()); 53 casper.start().setContent(xunit.getSerializedXML());
54 test.assertExists('testsuite[name="foo"][package="foo"][tests="1"][failures="0"] testcase[name="footext"]'); 54 test.assertExists('testsuite[name="foo"][package="foo"][tests="1"][failures="0"] testcase[name="footext"]');
55 test.done(); 55 test.done();
56 }); 56 });
...@@ -70,7 +70,7 @@ casper.test.begin('XUnitReporter() can handle a failed test', 2, function suite( ...@@ -70,7 +70,7 @@ casper.test.begin('XUnitReporter() can handle a failed test', 2, function suite(
70 }); 70 });
71 results.push(suite1); 71 results.push(suite1);
72 xunit.setResults(results); 72 xunit.setResults(results);
73 casper.start().setContent(xunit.getXML()); 73 casper.start().setContent(xunit.getSerializedXML());
74 test.assertExists('testsuite[name="foo"][package="foo"][tests="1"][failures="1"] testcase[name="footext"] failure[type="footype"]'); 74 test.assertExists('testsuite[name="foo"][package="foo"][tests="1"][failures="1"] testcase[name="footext"] failure[type="footype"]');
75 test.assertEquals(casper.getElementInfo('failure[type="footype"]').text, 'footext'); 75 test.assertEquals(casper.getElementInfo('failure[type="footype"]').text, 'footext');
76 test.done(); 76 test.done();
......