|
||||||
SUMMARY: CHILDREN | PARAMETER | INSTPROC | INSTFILTER | INSTFORWARD | DETAIL: | INSTPROC |
::xotcl::Object | +--::xox::Node
TestResult is an aggregation of smaller test results. It contains all the TestPass and TestFailure objects that are recorded from running a test.
Variables | |||
Name | Default Value | Class | Comment |
name |
unnamed | ::xounit::TestResult | name of the test |
nodeName |
::xox::Node | ||
testedClass |
"" | ::xounit::TestResult | the class tested |
testedMethod |
"" | ::xounit::TestResult | the method tested |
testedObject |
"" | ::xounit::TestResult | the object tested |
Methods | |
Name | Comment |
addNewResult {class args}
| |
addResult {result}
| Adds a subresult to the current TestResult in the result-tree |
deepErrors {}
| Returns all TestErrors that are in the subtree under this TestResult |
deepFailures {}
| Returns all TestFailures that are in the subtree under this TestResult |
deepPasses {}
| Returns all TestPasses that are in the subtree under this TestResult |
errors {}
| Returns all TestErrors that are direct children of this TestResult |
failures {}
| Returns all TestFailures that are direct children of this TestResult |
numberOfErrors {}
| returns the number of errors in this TestResult |
numberOfFailures {}
| returns the number of failures in this TestResult |
numberOfPasses {}
| returns the number of passes in this TestResult |
numberOfTests {}
| returns the number of tests in this TestResult |
passPercent {}
| returns the percentage of tests that passed |
passed {}
| returns 1 only if there are no failures or errors in this TestResult |
passes {}
| Returns all TestPasses that are direct children of this TestResult |
results {}
| |
tests {}
| returns all tests in this TestResult |
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 |
class
args
::xounit::TestResult instproc addNewResult {class args} { #my debug $args return [ my createAutoNamedChildInternal $class $args ] }
Adds a subresult to the current TestResult in the result-tree.
result
::xounit::TestResult instproc addResult {result} { return [ my addAutoNameNode $result ] }
Returns all TestErrors that are in the subtree under this TestResult.
::xounit::TestResult instproc deepErrors {} { set errors "" foreach result [ my results ] { if [ $result hasclass ::xounit::TestFailure ] { continue } if [ $result hasclass ::xounit::TestPass ] { continue } if [ $result hasclass ::xounit::TestError ] { lappend errors $result continue } set errors [ concat $errors [ $result deepErrors ] ] } return $errors }
Returns all TestFailures that are in the subtree under this TestResult.
::xounit::TestResult instproc deepFailures {} { set failures "" foreach result [ my results ] { if [ $result hasclass ::xounit::TestError ] { continue } if [ $result hasclass ::xounit::TestPass ] { continue } if [ $result hasclass ::xounit::TestFailure ] { lappend failures $result continue } set failures [ concat $failures [ $result deepFailures ] ] } return $failures }
Returns all TestPasses that are in the subtree under this TestResult.
::xounit::TestResult instproc deepPasses {} { set passes "" foreach result [ my results ] { if [ $result hasclass ::xounit::TestFailure ] { continue } if [ $result hasclass ::xounit::TestError ] { continue } if [ $result hasclass ::xounit::TestPass ] { lappend passes $result continue } set passes [ concat $passes [ $result deepPasses ] ] } return $passes }
Returns all TestErrors that are direct children of this TestResult.
::xounit::TestResult instproc errors {} { set errors "" foreach result [ my results ] { if [ $result hasclass ::xounit::TestError ] { lappend errors $result } } return $errors }
Returns all TestFailures that are direct children of this TestResult.
::xounit::TestResult instproc failures {} { set failures "" foreach result [ my results ] { if [ $result hasclass ::xounit::TestFailure ] { lappend failures $result } } return $failures }
returns the number of errors in this TestResult
::xounit::TestResult instproc numberOfErrors {} { set errors 0 foreach result [ my results ] { incr errors [ $result numberOfErrors ] } return $errors }
returns the number of failures in this TestResult
::xounit::TestResult instproc numberOfFailures {} { set failures 0 foreach result [ my results ] { incr failures [ $result numberOfFailures ] } return $failures }
returns the number of passes in this TestResult
::xounit::TestResult instproc numberOfPasses {} { set passes 0 foreach result [ my results ] { incr passes [ $result numberOfPasses ] } return $passes }
returns the number of tests in this TestResult
::xounit::TestResult instproc numberOfTests {} { set tests 0 foreach result [ my results ] { incr tests [ $result numberOfTests ] } return $tests }
returns the percentage of tests that passed.
::xounit::TestResult instproc passPercent {} { set total [ my numberOfTests ] set passes [ my numberOfPasses ] if { $total == 0 } { return 0.0 } return [ expr 100.0 * $passes / $total ] }
returns 1 only if there are no failures or errors in this TestResult. returns 0 otherwise
::xounit::TestResult instproc passed {} { foreach result [ my results ] { if { ! [ $result passed ] } { return 0 } } return 1 }
Returns all TestPasses that are direct children of this TestResult.
::xounit::TestResult instproc passes {} { set passes "" foreach result [ my results ] { if [ $result hasclass ::xounit::TestPass ] { lappend passes $result } } return $passes }
::xounit::TestResult instproc results {} { return [ ::xox::removeIfNot { $result hasclass ::xounit::TestResult } result [ my info children ] ] }
returns all tests in this TestResult. returns all errors, failures, and passes
::xounit::TestResult instproc tests {} { return [ concat [ my errors ] [ my failures ] [ my passes ] ] }