Commit 08625bd0 08625bd0e3884cac45e7b3b3816519e402cd1c13 by Nicolas Perriault

migrated tester/asserts tests to new testing format

1 parent af9dcbc2
......@@ -3,15 +3,15 @@
var tester = require('tester');
var testpage = require('webpage').create();
casper.test.begin('XUnitReporter() initialization', 1, function suite() {
casper.test.begin('XUnitReporter() initialization', 1, function suite(test) {
var xunit = require('xunit').create();
var results = new tester.TestSuiteResult();
xunit.setResults(results);
this.assertTruthy(xunit.getXML());
this.done();
test.assertTruthy(xunit.getXML());
test.done();
});
casper.test.begin('XUnitReporter() can hold test suites', 4, function suite() {
casper.test.begin('XUnitReporter() can hold test suites', 4, function suite(test) {
var xunit = require('xunit').create();
var results = new tester.TestSuiteResult();
var suite1 = new tester.TestCaseResult({
......@@ -26,16 +26,16 @@ casper.test.begin('XUnitReporter() can hold test suites', 4, function suite() {
results.push(suite2);
xunit.setResults(results);
casper.start().setContent(xunit.getXML());
this.assertEvalEquals(function() {
test.assertEvalEquals(function() {
return __utils__.findAll('testsuite').length;
}, 2);
this.assertExists('testsuites[duration]');
this.assertExists('testsuite[name="foo"][package="foo"]');
this.assertExists('testsuite[name="bar"][package="bar"]');
this.done();
test.assertExists('testsuites[duration]');
test.assertExists('testsuite[name="foo"][package="foo"]');
test.assertExists('testsuite[name="bar"][package="bar"]');
test.done();
});
casper.test.begin('XUnitReporter() can hold a suite with a succesful test', 1, function suite() {
casper.test.begin('XUnitReporter() can hold a suite with a succesful test', 1, function suite(test) {
var xunit = require('xunit').create();
var results = new tester.TestSuiteResult();
var suite1 = new tester.TestCaseResult({
......@@ -51,11 +51,11 @@ casper.test.begin('XUnitReporter() can hold a suite with a succesful test', 1, f
results.push(suite1);
xunit.setResults(results);
casper.start().setContent(xunit.getXML());
this.assertExists('testsuite[name="foo"][package="foo"][tests="1"][failures="0"] testcase[name="footext"]');
casper.test.done();
test.assertExists('testsuite[name="foo"][package="foo"][tests="1"][failures="0"] testcase[name="footext"]');
test.done();
});
casper.test.begin('XUnitReporter() can handle a failed test', 2, function suite() {
casper.test.begin('XUnitReporter() can handle a failed test', 2, function suite(test) {
var xunit = require('xunit').create();
var results = new tester.TestSuiteResult();
var suite1 = new tester.TestCaseResult({
......@@ -71,7 +71,7 @@ casper.test.begin('XUnitReporter() can handle a failed test', 2, function suite(
results.push(suite1);
xunit.setResults(results);
casper.start().setContent(xunit.getXML());
this.assertExists('testsuite[name="foo"][package="foo"][tests="1"][failures="1"] testcase[name="footext"] failure[type="footype"]');
this.assertEquals(casper.getElementInfo('failure[type="footype"]').text, 'footext');
casper.test.done();
test.assertExists('testsuite[name="foo"][package="foo"][tests="1"][failures="1"] testcase[name="footext"] failure[type="footype"]');
test.assertEquals(casper.getElementInfo('failure[type="footype"]').text, 'footext');
test.done();
});
......