Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
casperjs
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
08625bd0
...
08625bd0e3884cac45e7b3b3816519e402cd1c13
authored
2012-12-28 13:43:07 +0100
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
migrated tester/asserts tests to new testing format
1 parent
af9dcbc2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
16 deletions
tests/suites/tester/assert.js
tests/suites/xunit.js
tests/suites/tester/assert.js
View file @
08625bd
This diff is collapsed.
Click to expand it.
tests/suites/xunit.js
View file @
08625bd
...
...
@@ -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
);
t
his
.
assertTruthy
(
xunit
.
getXML
());
t
his
.
done
();
t
est
.
assertTruthy
(
xunit
.
getXML
());
t
est
.
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
());
t
his
.
assertEvalEquals
(
function
()
{
t
est
.
assertEvalEquals
(
function
()
{
return
__utils__
.
findAll
(
'testsuite'
).
length
;
},
2
);
t
his
.
assertExists
(
'testsuites[duration]'
);
t
his
.
assertExists
(
'testsuite[name="foo"][package="foo"]'
);
t
his
.
assertExists
(
'testsuite[name="bar"][package="bar"]'
);
t
his
.
done
();
t
est
.
assertExists
(
'testsuites[duration]'
);
t
est
.
assertExists
(
'testsuite[name="foo"][package="foo"]'
);
t
est
.
assertExists
(
'testsuite[name="bar"][package="bar"]'
);
t
est
.
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
());
t
his
.
assertExists
(
'testsuite[name="foo"][package="foo"][tests="1"][failures="0"] testcase[name="footext"]'
);
casper
.
test
.
done
();
t
est
.
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
());
t
his
.
assertExists
(
'testsuite[name="foo"][package="foo"][tests="1"][failures="1"] testcase[name="footext"] failure[type="footype"]'
);
t
his
.
assertEquals
(
casper
.
getElementInfo
(
'failure[type="footype"]'
).
text
,
'footext'
);
casper
.
test
.
done
();
t
est
.
assertExists
(
'testsuite[name="foo"][package="foo"][tests="1"][failures="1"] testcase[name="footext"] failure[type="footype"]'
);
t
est
.
assertEquals
(
casper
.
getElementInfo
(
'failure[type="footype"]'
).
text
,
'footext'
);
test
.
done
();
});
...
...
Please
register
or
sign in
to post a comment