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
e8e17db0
...
e8e17db0519e379da8b280c9c0a0a5da6a1611a5
authored
2012-01-30 19:35:20 +0100
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fixes #48 - XML Output file doesn't have classpath populated with file name
1 parent
062eba7b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
modules/xunit.js
tests/suites/xunit.js
modules/xunit.js
View file @
e8e17db
...
...
@@ -91,12 +91,18 @@ XUnitExporter.prototype.addFailure = function(classname, name, message, type) {
* @return String
*/
function
generateClassName
(
classname
)
{
classname
=
classname
.
replace
(
phantom
.
casperPath
,
""
).
trim
();
var
script
=
classname
||
phantom
.
casperScript
;
if
(
script
.
indexOf
(
fs
.
workingDirectory
)
===
0
)
{
script
=
script
.
substring
(
fs
.
workingDirectory
.
length
+
1
);
return
script
.
substring
(
0
,
script
.
lastIndexOf
(
'.'
));
}
return
classname
||
"unknown"
;
if
(
script
.
indexOf
(
'/'
)
===
0
)
{
script
=
script
.
substring
(
1
,
script
.
length
);
}
if
(
~
script
.
indexOf
(
'.'
))
{
script
=
script
.
substring
(
0
,
script
.
lastIndexOf
(
'.'
));
}
return
script
||
"unknown"
;
}
/**
...
...
tests/suites/xunit.js
View file @
e8e17db
...
...
@@ -7,7 +7,10 @@ xunit.addFailure('bar', 'baz', 'wrong', 'chucknorriz');
casper
.
test
.
assertMatch
(
xunit
.
getXML
(),
/<testcase classname="bar" name="baz"><failure type="chucknorriz">wrong/
,
'XUnitExporter.addFailure() adds a failed testcase'
);
// named classname
xunit
=
require
(
'xunit'
).
create
();
xunit
.
addSuccess
(
require
(
'fs'
).
workingDirectory
+
'/plop.js'
,
'It worked'
);
casper
.
test
.
assertMatch
(
xunit
.
getXML
(),
/<testcase classname="plop" name="It worked"/
,
'XUnitExporter.addSuccess() handles class name'
);
xunit
.
addSuccess
(
require
(
'fs'
).
workingDirectory
+
'/plip.js'
,
'Failure'
);
casper
.
test
.
assertMatch
(
xunit
.
getXML
(),
/<testcase classname="plip" name="Failure"/
,
'XUnitExporter.addFailure() handles class name'
);
casper
.
test
.
done
();
\ No newline at end of file
...
...
Please
register
or
sign in
to post a comment