migrated tester/asserts tests to new testing format
Showing
2 changed files
with
16 additions
and
16 deletions
This diff is collapsed.
Click to expand it.
... | @@ -3,15 +3,15 @@ | ... | @@ -3,15 +3,15 @@ |
3 | var tester = require('tester'); | 3 | var tester = require('tester'); |
4 | var testpage = require('webpage').create(); | 4 | var testpage = require('webpage').create(); |
5 | 5 | ||
6 | casper.test.begin('XUnitReporter() initialization', 1, function suite() { | 6 | 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 | this.assertTruthy(xunit.getXML()); | 10 | test.assertTruthy(xunit.getXML()); |
11 | this.done(); | 11 | test.done(); |
12 | }); | 12 | }); |
13 | 13 | ||
14 | casper.test.begin('XUnitReporter() can hold test suites', 4, function suite() { | 14 | casper.test.begin('XUnitReporter() can hold test suites', 4, function suite(test) { |
15 | var xunit = require('xunit').create(); | 15 | var xunit = require('xunit').create(); |
16 | var results = new tester.TestSuiteResult(); | 16 | var results = new tester.TestSuiteResult(); |
17 | var suite1 = new tester.TestCaseResult({ | 17 | var suite1 = new tester.TestCaseResult({ |
... | @@ -26,16 +26,16 @@ casper.test.begin('XUnitReporter() can hold test suites', 4, function suite() { | ... | @@ -26,16 +26,16 @@ casper.test.begin('XUnitReporter() can hold test suites', 4, function suite() { |
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.getXML()); |
29 | this.assertEvalEquals(function() { | 29 | test.assertEvalEquals(function() { |
30 | return __utils__.findAll('testsuite').length; | 30 | return __utils__.findAll('testsuite').length; |
31 | }, 2); | 31 | }, 2); |
32 | this.assertExists('testsuites[duration]'); | 32 | test.assertExists('testsuites[duration]'); |
33 | this.assertExists('testsuite[name="foo"][package="foo"]'); | 33 | test.assertExists('testsuite[name="foo"][package="foo"]'); |
34 | this.assertExists('testsuite[name="bar"][package="bar"]'); | 34 | test.assertExists('testsuite[name="bar"][package="bar"]'); |
35 | this.done(); | 35 | test.done(); |
36 | }); | 36 | }); |
37 | 37 | ||
38 | casper.test.begin('XUnitReporter() can hold a suite with a succesful test', 1, function suite() { | 38 | casper.test.begin('XUnitReporter() can hold a suite with a succesful test', 1, function suite(test) { |
39 | var xunit = require('xunit').create(); | 39 | var xunit = require('xunit').create(); |
40 | var results = new tester.TestSuiteResult(); | 40 | var results = new tester.TestSuiteResult(); |
41 | var suite1 = new tester.TestCaseResult({ | 41 | var suite1 = new tester.TestCaseResult({ |
... | @@ -51,11 +51,11 @@ casper.test.begin('XUnitReporter() can hold a suite with a succesful test', 1, f | ... | @@ -51,11 +51,11 @@ casper.test.begin('XUnitReporter() can hold a suite with a succesful test', 1, f |
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.getXML()); |
54 | this.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 | casper.test.done(); | 55 | test.done(); |
56 | }); | 56 | }); |
57 | 57 | ||
58 | casper.test.begin('XUnitReporter() can handle a failed test', 2, function suite() { | 58 | casper.test.begin('XUnitReporter() can handle a failed test', 2, function suite(test) { |
59 | var xunit = require('xunit').create(); | 59 | var xunit = require('xunit').create(); |
60 | var results = new tester.TestSuiteResult(); | 60 | var results = new tester.TestSuiteResult(); |
61 | var suite1 = new tester.TestCaseResult({ | 61 | var suite1 = new tester.TestCaseResult({ |
... | @@ -71,7 +71,7 @@ casper.test.begin('XUnitReporter() can handle a failed test', 2, function suite( | ... | @@ -71,7 +71,7 @@ casper.test.begin('XUnitReporter() can handle a failed test', 2, function suite( |
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.getXML()); |
74 | this.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 | this.assertEquals(casper.getElementInfo('failure[type="footype"]').text, 'footext'); | 75 | test.assertEquals(casper.getElementInfo('failure[type="footype"]').text, 'footext'); |
76 | casper.test.done(); | 76 | test.done(); |
77 | }); | 77 | }); | ... | ... |
-
Please register or sign in to post a comment