don't count dubious tests in final fail count
Showing
1 changed file
with
35 additions
and
4 deletions
... | @@ -1237,9 +1237,10 @@ Tester.prototype.renderResults = function renderResults(exit, status, save) { | ... | @@ -1237,9 +1237,10 @@ Tester.prototype.renderResults = function renderResults(exit, status, save) { |
1237 | "use strict"; | 1237 | "use strict"; |
1238 | /*jshint maxstatements:20*/ | 1238 | /*jshint maxstatements:20*/ |
1239 | save = save || this.options.save; | 1239 | save = save || this.options.save; |
1240 | var failed = this.suiteResults.countFailed(), | 1240 | var dubious = this.suiteResults.countDubious(), |
1241 | failed = this.suiteResults.countFailed(), | ||
1241 | passed = this.suiteResults.countPassed(), | 1242 | passed = this.suiteResults.countPassed(), |
1242 | total = this.suiteResults.countTotal(), | 1243 | total = this.suiteResults.countExecuted(), |
1243 | statusText, | 1244 | statusText, |
1244 | style, | 1245 | style, |
1245 | result, | 1246 | result, |
... | @@ -1256,12 +1257,13 @@ Tester.prototype.renderResults = function renderResults(exit, status, save) { | ... | @@ -1256,12 +1257,13 @@ Tester.prototype.renderResults = function renderResults(exit, status, save) { |
1256 | statusText = this.options.passText; | 1257 | statusText = this.options.passText; |
1257 | style = 'GREEN_BAR'; | 1258 | style = 'GREEN_BAR'; |
1258 | } | 1259 | } |
1259 | result = f('%s %s tests executed in %ss, %d passed, %d failed.', | 1260 | result = f('%s %s tests executed in %ss, %d passed, %d failed%s.', |
1260 | statusText, | 1261 | statusText, |
1261 | total, | 1262 | total, |
1262 | utils.ms2seconds(this.suiteResults.calculateDuration()), | 1263 | utils.ms2seconds(this.suiteResults.calculateDuration()), |
1263 | passed, | 1264 | passed, |
1264 | failed); | 1265 | failed, |
1266 | dubious ? f(' (%d dubious)', dubious) : ''); | ||
1265 | } | 1267 | } |
1266 | this.casper.echo(result, style, this.options.pad); | 1268 | this.casper.echo(result, style, this.options.pad); |
1267 | if (failed > 0) { | 1269 | if (failed > 0) { |
... | @@ -1426,6 +1428,30 @@ TestSuiteResult.prototype.countTotal = function countTotal() { | ... | @@ -1426,6 +1428,30 @@ TestSuiteResult.prototype.countTotal = function countTotal() { |
1426 | }; | 1428 | }; |
1427 | 1429 | ||
1428 | /** | 1430 | /** |
1431 | * Returns the number of dubious results. | ||
1432 | * | ||
1433 | * @return Number | ||
1434 | */ | ||
1435 | TestSuiteResult.prototype.countDubious = function countDubious() { | ||
1436 | "use strict"; | ||
1437 | return this.map(function(result) { | ||
1438 | return result.dubious; | ||
1439 | }).reduce(function(a, b) { | ||
1440 | return a + b; | ||
1441 | }, 0); | ||
1442 | }; | ||
1443 | |||
1444 | /** | ||
1445 | * Returns the number of executed tests. | ||
1446 | * | ||
1447 | * @return Number | ||
1448 | */ | ||
1449 | TestSuiteResult.prototype.countExecuted = function countTotal() { | ||
1450 | "use strict"; | ||
1451 | return this.countTotal() - this.countDubious(); | ||
1452 | }; | ||
1453 | |||
1454 | /** | ||
1429 | * Returns the number of errors. | 1455 | * Returns the number of errors. |
1430 | * | 1456 | * |
1431 | * @return Number | 1457 | * @return Number |
... | @@ -1568,6 +1594,11 @@ function TestCaseResult(options) { | ... | @@ -1568,6 +1594,11 @@ function TestCaseResult(options) { |
1568 | this.__defineGetter__("failed", function() { | 1594 | this.__defineGetter__("failed", function() { |
1569 | return this.failures.length; | 1595 | return this.failures.length; |
1570 | }); | 1596 | }); |
1597 | this.__defineGetter__("dubious", function() { | ||
1598 | return this.failures.filter(function(failure) { | ||
1599 | return failure.type === "dubious"; | ||
1600 | }).length; | ||
1601 | }); | ||
1571 | this.__defineGetter__("passed", function() { | 1602 | this.__defineGetter__("passed", function() { |
1572 | return this.passes.length; | 1603 | return this.passes.length; |
1573 | }); | 1604 | }); | ... | ... |
-
Please register or sign in to post a comment