|
||||||
SUMMARY: CHILDREN | PARAMETER | INSTPROC | INSTFILTER | INSTFORWARD | DETAIL: | INSTPROC |
::xotcl::Object
TestResultsTextFormatter is a utility class to generate human readable results in plan ASCII text. The input to the formatting methods should be a list of TestResult objects.
Variables | |||
Name | Default Value | Class | Comment |
Methods | |
Name | Comment |
formatResults {results}
| Format a list of results and return the formatted string |
numberOfErrors {results}
| Count the total number of test errors |
numberOfFailures {results}
| Count the total number of test failures |
numberOfPasses {results}
| Count the total number of tests that passed |
numberOfTests {results}
| Count the total number of tests run |
printError {anError}
| Format a TestError |
printFailure {aFailure}
| Format a TestFailure |
printPass {aPass}
| Format a TestPass |
printResult {aResult}
| Format one TestResult and return the string |
printResultSummary {aResult}
| |
printResults {results}
| Format and print a list of results to stdout |
printSubResult {aResult}
| Format a subtest result |
resultsPass {results}
| Count the number of results that passed |
testSummary {results}
| Format a summary of a list of TestResults |
Methods from ::xotcl::Object |
#, ., ?, ?code, ?methods, ?object, abstract, copy, coverageFilter, defaultmethod, extractConfigureArg, filterappend, garbageCollect, get#, getClean#, hasclass, init, methodTag, mixinappend, move, profileFilter, self, setParameterDefaults, shell, tclcmd, traceFilter,
|
Instproc Detail |
Format a list of results and return the formatted string.
results
::xounit::TestResultsTextFormatter instproc formatResults {results} { set buffer "" foreach result $results { append buffer [ my printResult $result ] } append buffer "=================\n" append buffer [ my testSummary $results ] return $buffer }
Count the total number of test errors.
results
::xounit::TestResultsTextFormatter instproc numberOfErrors {results} { set number 0 foreach result $results { incr number [ $result numberOfErrors ] } return $number }
Count the total number of test failures.
results
::xounit::TestResultsTextFormatter instproc numberOfFailures {results} { set number 0 foreach result $results { incr number [ $result numberOfFailures ] } return $number }
Count the total number of tests that passed.
results
::xounit::TestResultsTextFormatter instproc numberOfPasses {results} { set number 0 foreach result $results { incr number [ $result numberOfPasses ] } return $number }
Count the total number of tests run.
results
::xounit::TestResultsTextFormatter instproc numberOfTests {results} { set number 0 foreach result $results { incr number [ $result numberOfTests ] } return $number }
Format a TestError
anError
::xounit::TestResultsTextFormatter instproc printError {anError} { return "Error: [ $anError name ] [$anError test]\n[$anError error]\n\n" }
Format a TestFailure
aFailure
::xounit::TestResultsTextFormatter instproc printFailure {aFailure} { return "Failure: [ $aFailure name ] [$aFailure test]\n[$aFailure error]\n\n" }
Format a TestPass
aPass
::xounit::TestResultsTextFormatter instproc printPass {aPass} { return "Pass: [ $aPass name ] [$aPass test] [$aPass return]\n\n" }
Format one TestResult and return the string.
aResult
::xounit::TestResultsTextFormatter instproc printResult {aResult} { set buffer "" append buffer [ my printSubResult $aResult ] append buffer [ my printResultSummary $aResult ] return $buffer }
aResult
::xounit::TestResultsTextFormatter instproc printResultSummary {aResult} { set buffer "" if [ $aResult passed ] { append buffer "All Passed: [ $aResult numberOfPasses ]\n" } else { append buffer "Errors: [ $aResult numberOfErrors ] " append buffer "Failures: [ $aResult numberOfFailures ] " append buffer "Passes: [ $aResult numberOfPasses ]\n" } return $buffer }
Format and print a list of results to stdout.
results
::xounit::TestResultsTextFormatter instproc printResults {results} { set text [my formatResults $results] puts $text flush stdout return $text }
Format a subtest result.
aResult
::xounit::TestResultsTextFormatter instproc printSubResult {aResult} { set buffer "" append buffer "[ $aResult name ]\n" foreach result [ $aResult results ] { if [ $result hasclass ::xounit::TestPass ] { append buffer [ my printPass $result ] continue } if [ $result hasclass ::xounit::TestFailure ] { append buffer [ my printFailure $result ] continue } if [ $result hasclass ::xounit::TestError ] { append buffer [ my printError $result ] continue } append buffer [ my printSubResult $result ] } return $buffer }
Count the number of results that passed.
results
::xounit::TestResultsTextFormatter instproc resultsPass {results} { set number 0 foreach result $results { if [ $result passed ] { incr number } } return $number }
Format a summary of a list of TestResults.
results
::xounit::TestResultsTextFormatter instproc testSummary {results} { set buffer "" append buffer "Tests: [ my numberOfTests $results ]\n" append buffer "Errors: [ my numberOfErrors $results ]\n" append buffer "Failures: [ my numberOfFailures $results ]\n" append buffer "Passes: [ my numberOfPasses $results ]\n" return $buffer }