Added support of Ignore, Canceled and Pending added in the latest framework API.

This commit is contained in:
cheeseng 2013-06-27 17:29:36 +08:00
parent 5bb46359b5
commit 0c66d1a5d3
2 changed files with 12 additions and 8 deletions

View File

@ -230,12 +230,14 @@ object Tests
// Print the standard one-liner statistic if no framework summary is defined, or when > 1 framework is in used. // Print the standard one-liner statistic if no framework summary is defined, or when > 1 framework is in used.
if (printStandard) if (printStandard)
{ {
val (skippedCount, errorsCount, passedCount, failuresCount) = val (skippedCount, errorsCount, passedCount, failuresCount, ignoredCount, canceledCount, pendingCount) =
results.events.foldLeft((0, 0, 0, 0)) { case (acc, (name, testEvent)) => results.events.foldLeft((0, 0, 0, 0, 0, 0, 0)) { case ((skippedAcc, errorAcc, passedAcc, failureAcc, ignoredAcc, canceledAcc, pendingAcc), (name, testEvent)) =>
(acc._1 + testEvent.skippedCount, acc._2 + testEvent.errorCount, acc._3 + testEvent.passedCount, acc._4 + testEvent.failureCount) (skippedAcc + testEvent.skippedCount, errorAcc + testEvent.errorCount, passedAcc + testEvent.passedCount, failureAcc + testEvent.failureCount,
ignoredAcc + testEvent.ignoredCount, canceledAcc + testEvent.canceledCount, pendingAcc + testEvent.pendingCount)
} }
val totalCount = failuresCount + errorsCount + skippedCount + passedCount val totalCount = failuresCount + errorsCount + skippedCount + passedCount
val postfix = "Total " + totalCount + ", Failed " + failuresCount + ", Errors " + errorsCount + ", Passed " + passedCount + ", Skipped " + skippedCount val postfix = "Total " + totalCount + ", Failed " + failuresCount + ", Errors " + errorsCount + ", Passed " + passedCount + ", Skipped " + skippedCount +
", Ignored " + ignoredCount + ", Canceled " + canceledCount + ", Pending " + pendingCount
results.overall match { results.overall match {
case TestResult.Error => log.error("Error: " + postfix) case TestResult.Error => log.error("Error: " + postfix)
case TestResult.Passed => log.info("Passed: " + postfix) case TestResult.Passed => log.info("Passed: " + postfix)

View File

@ -28,7 +28,8 @@ trait TestsListener extends TestReportListener
def doComplete(finalResult: TestResult.Value) def doComplete(finalResult: TestResult.Value)
} }
final class SuiteResult(val result: TestResult.Value, val passedCount: Int, val failureCount: Int, val errorCount: Int, val skippedCount: Int) final class SuiteResult(val result: TestResult.Value, val passedCount: Int, val failureCount: Int, val errorCount: Int, val skippedCount: Int,
val ignoredCount: Int, val canceledCount: Int, val pendingCount: Int)
object SuiteResult object SuiteResult
{ {
def apply(events: Seq[TEvent]): SuiteResult = def apply(events: Seq[TEvent]): SuiteResult =
@ -40,10 +41,11 @@ object SuiteResult
else if(sum == TestResult.Failed || status == TStatus.Failure) TestResult.Failed else if(sum == TestResult.Failed || status == TStatus.Failure) TestResult.Failed
else TestResult.Passed else TestResult.Passed
} }
new SuiteResult (overallResult, count(TStatus.Success), count(TStatus.Failure), count(TStatus.Error), count(TStatus.Skipped)) new SuiteResult (overallResult, count(TStatus.Success), count(TStatus.Failure), count(TStatus.Error), count(TStatus.Skipped),
count(TStatus.Ignored), count(TStatus.Canceled), count(TStatus.Pending))
} }
val Error: SuiteResult = new SuiteResult(TestResult.Error, 0, 0, 0, 0) val Error: SuiteResult = new SuiteResult(TestResult.Error, 0, 0, 0, 0, 0, 0, 0)
val Empty: SuiteResult = new SuiteResult(TestResult.Passed, 0, 0, 0, 0) val Empty: SuiteResult = new SuiteResult(TestResult.Passed, 0, 0, 0, 0, 0, 0, 0)
} }
abstract class TestEvent extends NotNull abstract class TestEvent extends NotNull