зеркало из https://github.com/mozilla/gecko-dev.git
Bug 387455: adjust browser chrome test harness output (provide summary, don't fail if there are no tests), r=robcee
This commit is contained in:
Родитель
13844e53a2
Коммит
4b1ee195c1
|
@ -102,14 +102,18 @@
|
|||
|
||||
function browserTestFile(aTestFile) {
|
||||
this.path = aTestFile;
|
||||
this.exception = null;
|
||||
this.timedOut = false;
|
||||
this.tests = [];
|
||||
this.scope = null;
|
||||
}
|
||||
browserTestFile.prototype = {
|
||||
get allPassed() {
|
||||
return !this.tests.some(function (t) !t.pass);
|
||||
get passCount() {
|
||||
return this.tests.filter(function (t) !t.todo && t.pass).length;
|
||||
},
|
||||
get todoCount() {
|
||||
return this.tests.filter(function (t) t.todo && t.pass).length;
|
||||
},
|
||||
get failCount() {
|
||||
return this.tests.filter(function (t) !t.pass).length;
|
||||
},
|
||||
get log() {
|
||||
return this.tests.map(function (t) t.msg).join("\n");
|
||||
|
@ -154,16 +158,23 @@
|
|||
}
|
||||
|
||||
function getLogFromTests(aTests) {
|
||||
return aTests.map(function (f) {
|
||||
var output = f.path + "\n";
|
||||
if (f.log)
|
||||
output += f.log + "\n";
|
||||
if (f.exception)
|
||||
output += "\tFAIL - Exception thrown: " + f.exception + "\n";
|
||||
if (f.timedOut)
|
||||
output += "\tFAIL - Timed out\n";
|
||||
return output;
|
||||
}).join("");
|
||||
if (!aTests.length)
|
||||
return "PASS - No tests to run";
|
||||
|
||||
var log = aTests.map(function (f) {
|
||||
var output = f.path + "\n";
|
||||
if (f.log)
|
||||
output += f.log + "\n";
|
||||
return output;
|
||||
}).join("");
|
||||
log += "\nBrowser Chrome Test Summary\n";
|
||||
function sum(a, b){ return a + b; }
|
||||
var passCount = aTests.map(function (f) f.passCount).reduce(sum);
|
||||
var failCount = aTests.map(function (f) f.failCount).reduce(sum);
|
||||
var todoCount = aTests.map(function (f) f.todoCount).reduce(sum);
|
||||
log += "\tPass: " + passCount + "\n\tFail: " + failCount + "\n\tTodo: " + todoCount + "\n";
|
||||
|
||||
return log;
|
||||
}
|
||||
|
||||
function testsFinished(aTests) {
|
||||
|
|
|
@ -70,13 +70,12 @@ Tester.prototype = {
|
|||
try {
|
||||
this.currentTest.scope.test();
|
||||
} catch (ex) {
|
||||
this.currentTest.exception = ex;
|
||||
this.currentTest.tests.push(new testResult(false, "Exception thrown", ex, false));
|
||||
}
|
||||
|
||||
// If the test ran synchronously, set the result and move to the next test,
|
||||
// If the test ran synchronously, move to the next test,
|
||||
// otherwise start a poller to monitor it's progress.
|
||||
if (this.currentTest.scope.done) {
|
||||
this.currentTest.result = this.currentTest.scope.result;
|
||||
this.execTest();
|
||||
} else {
|
||||
var self = this;
|
||||
|
@ -90,9 +89,13 @@ function testResult(aCondition, aName, aDiag, aIsTodo) {
|
|||
aName = aName || "";
|
||||
|
||||
this.pass = !!aCondition;
|
||||
if (this.pass)
|
||||
this.msg = "\tPASS - " + aName;
|
||||
else {
|
||||
this.todo = aIsTodo;
|
||||
if (this.pass) {
|
||||
if (aIsTodo)
|
||||
this.msg = "\tTODO PASS - " + aName;
|
||||
else
|
||||
this.msg = "\tPASS - " + aName;
|
||||
} else {
|
||||
this.msg = "\tFAIL - ";
|
||||
if (aIsTodo)
|
||||
this.msg += "TODO Worked? - ";
|
||||
|
@ -158,14 +161,11 @@ resultPoller.prototype = {
|
|||
self.loopCount++;
|
||||
|
||||
if (self.loopCount > MAX_LOOP_COUNT) {
|
||||
self.test.timedOut = true;
|
||||
self.test.tests.push(new testResult(false, "Timed out", "", false));
|
||||
self.test.scope.done = true;
|
||||
}
|
||||
|
||||
if (self.test.scope.done) {
|
||||
// Set the result
|
||||
self.test.result = self.test.scope.result;
|
||||
|
||||
clearInterval(self.interval);
|
||||
|
||||
// Notify the callback
|
||||
|
|
Загрузка…
Ссылка в новой задаче