Comparing version 0.0.16 to 0.0.17
@@ -23,3 +23,3 @@ YUI({ | ||
Y.Test.Runner.add(suite); | ||
Y.Test.Runner.run(); | ||
Y.UnitTest.go(); | ||
}); |
@@ -116,2 +116,12 @@ /* | ||
}); | ||
}, | ||
addTestOutput: function(test, msg) { | ||
var lines = msg.split(/\n/), | ||
now = new Date(), | ||
format; | ||
format = now.getFullYear() + '/' + (now.getMonth() + 1) + '/' + now.getDate() + ' ' + now.getHours() + ':' + now.getMinutes() + ':' + now.getSeconds(); | ||
lines.forEach(function(line) { | ||
test.output += '[' + format + '] ' + line + "\n"; | ||
}); | ||
} | ||
@@ -118,0 +128,0 @@ }; |
@@ -75,2 +75,4 @@ /* | ||
common.addTestOutput(test, 'Test running too long/timed out - blowing it out'); | ||
// Dump a FAILED XML file | ||
@@ -88,3 +90,6 @@ // Use test file name as the NAME of this test (vs. component name from test itself) | ||
hub.emit(hub.log, hub.ERROR, "Dumped error unit test file " + name + " / " + names[0] + " (from " + test.url + ")"); | ||
common.addTestOutput(test, "Dumped error unit test file " + name + " / " + names[0] + " (from " + test.url + ")"); | ||
common.dumpFile(params, 'results', names[0] + '-test.xml', name); | ||
common.dumpFile({ output: test.output }, 'output', names[0] + '.txt', name); | ||
@@ -126,2 +131,3 @@ if (cache.browsers[browser]) { | ||
// blow this test out! | ||
hub.emit(hub.LOG, hub.ERROR, "Deleting this test that was part of blow away browser: " + sys.inspect(test)); | ||
cache.tests_to_run.splice(i, 1); | ||
@@ -128,0 +134,0 @@ i--; // fake a perl 'redo'!! Otherwise we might skip over something! |
@@ -38,3 +38,3 @@ /* | ||
module.exports = { | ||
Create: function(hub) { | ||
Create: function(hub, common) { | ||
// Javascript is single threaded! We don't have to worry about concurrency! | ||
@@ -103,3 +103,4 @@ var path = require('path'); | ||
running: 0, | ||
url: path.join('/', hub.config.testDirWeb, test) | ||
url: path.join('/', hub.config.testDirWeb, test), | ||
output: '' | ||
}; | ||
@@ -130,2 +131,4 @@ | ||
common.addTestOutput(test_obj, 'Selenium test'); | ||
cache.tests_to_run.push(test_obj); | ||
@@ -137,2 +140,5 @@ pushed = true; | ||
test_obj.browser = req.session.uuid; | ||
common.addTestOutput(test_obj, 'Multiple in this browser test'); | ||
cache.tests_to_run.push(test_obj); | ||
@@ -144,2 +150,3 @@ pushed = true; | ||
test_obj.browser = browser; | ||
common.addTestOutput(test_obj, 'Capture test'); | ||
cache.tests_to_run.push(test_obj); | ||
@@ -150,2 +157,4 @@ pushed = true; | ||
} | ||
common.addTestOutput(test_obj, sys.inspect(test_obj)); | ||
} | ||
@@ -152,0 +161,0 @@ |
@@ -64,3 +64,6 @@ /* | ||
component = path.basename(component); | ||
component = path.basename(component); | ||
debugFiles = glob.globSync(path.join(baseDir, component, '*.txt')); | ||
snapshotFiles = glob.globSync(path.join(baseDir, component, '*.png')); | ||
testFiles = glob.globSync(path.join(baseDir, component, '*.xml')); | ||
@@ -77,4 +80,6 @@ testFiles.forEach(function(testFile) { | ||
ret.current_results[component] = {}; | ||
ret.current_results[component].test_results = testResults; | ||
ret.current_results[component].coverage = coverage; | ||
ret.current_results[component].test_results = testResults; | ||
ret.current_results[component].coverage = coverage; | ||
ret.current_results[component].debugFiles = debugFiles.map(function(f) { return path.basename(f); }); | ||
ret.current_results[component].snapshotFiles = snapshotFiles.map(function(f) { return path.basename(f); }); | ||
}); | ||
@@ -81,0 +86,0 @@ |
@@ -49,3 +49,3 @@ /* | ||
filename = names[0], pkgname = names[1], | ||
now = new Date().getTime(), | ||
now = new Date().getTime(), output = '', | ||
exec = require('child_process').exec | ||
@@ -63,2 +63,4 @@ ; | ||
hub.emit(hub.LONG, hub.INFO, "Test Report for " + obj.name); | ||
output += "Test Report for " + obj.name + "\n"; | ||
output += 'It: ' + (succeeded ? 'succeeded' : 'failed') + "\n"; | ||
} | ||
@@ -75,7 +77,9 @@ | ||
obj.coverage = JSON.stringify(cover_obj); | ||
names = common.dumpFile(obj, 'coverage', 'cover.json', obj.name); | ||
exec(hub.config.java + ' -jar ' + path.join(__dirname, "yuitest-coverage-report.jar") + " -o " + names[1] + " --format lcov " + names[0]); | ||
var namez = common.dumpFile(obj, 'coverage', 'cover.json', obj.name); | ||
exec(hub.config.java + ' -jar ' + path.join(__dirname, "yuitest-coverage-report.jar") + " -o " + namez[1] + " --format lcov " + namez[0]); | ||
hub.emit(hub.LONG, hub.INFO, "Coverage Report for " + obj.name); | ||
output += "Coverage Report for " + obj.name + ' generated'; | ||
} catch(e) { | ||
hub.emit(hub.LOG, hub.ERROR, "Error generating coverage report: " + e); | ||
output += "Error generating coverage report: " + e; | ||
} | ||
@@ -89,8 +93,12 @@ } | ||
if (test.browser == req.session.uuid) { | ||
common.addTestOutput(test, output); | ||
if (test.snapshot && test.sel_host) { | ||
common.takeSeleniumSnapshot(test, path.join(names[1], 'snapshot.png')); | ||
common.takeSeleniumSnapshot(test, path.join(names[1], path.basename(names[0], 'xml')) + 'png'); | ||
common.addTestOutput(test, "Took snapshot: " + path.join(names[1], path.basename(names[0], 'xml')) + 'png'); | ||
} | ||
if (test.sendOutput) { | ||
res.write(obj.name + "finished - it " + (succeeded ? 'SUCCEEDED' : 'FAILED') + ' it took ' + (now - test.running) + " seconds\n"); | ||
res.write(obj.name + " finished - it " + (succeeded ? 'SUCCEEDED' : 'FAILED') + ' it took ' + (now - test.running) + "ms\n"); | ||
} | ||
common.addTestOutput(test, obj.name + " finished - it " + (succeeded ? 'SUCCEEDED' : 'FAILED') + ' - it took ' + (now - test.running) + "ms\n"); | ||
common.dumpFile({ output: test.output }, 'output', path.basename(names[0], 'xml') + 'txt', obj.name); | ||
cache.tests_to_run.splice(i, 1); | ||
@@ -100,2 +108,7 @@ break; | ||
} | ||
if (!totalTests) { | ||
// A single browser test | ||
output += obj.name + " finished - it " + (succeeded ? 'SUCCEEDED' : 'FAILED') + "\n"; | ||
common.dumpFile({ output: output }, 'output', path.basename(names[0], 'xml') + 'txt', obj.name); | ||
} | ||
@@ -102,0 +115,0 @@ res.end('OK'); |
@@ -110,2 +110,15 @@ /* | ||
} | ||
if (value.snapshotFiles) { | ||
for (i = 0; i < value.snapshotFiles.length; i = i + 1) { | ||
file = value.snapshotFiles[i]; | ||
result_output += '<li><a target="_blank" title="' + file + '" href="/' + obj.config.outputDirWeb + '/' + key + '/' + file + '">SNAPSHOT ' + file + '</a></li>'; | ||
} | ||
} | ||
if (value.debugFiles) { | ||
for (i = 0; i < value.debugFiles.length; i = i + 1) { | ||
file = value.debugFiles[i]; | ||
result_output += '<li><a target="_blank" title="' + file + '" href="/' + obj.config.outputDirWeb + '/' + key + '/' + file + '">DEBUG ' + file + '</a></li>'; | ||
} | ||
} | ||
if (value.coverage == 1) { | ||
@@ -112,0 +125,0 @@ result_output += '<li><a target="_blank" href="/' + obj.config.outputDirWeb + '/' + key + '/lcov-report/index.html">Coverage Report</a></li>'; |
@@ -5,3 +5,3 @@ { | ||
"keywords": ["selenium", "test", "testing", "unit", "tests"], | ||
"version": "0.0.16", | ||
"version": "0.0.17", | ||
"author": "Mark Ethan Trostler <mark@zzo.com>", | ||
@@ -8,0 +8,0 @@ "preferGlobal": true, |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2022162
67
3228