::xounit
Class TestFailuresTextFormatter

Heritage:
::xotcl::Object
  |
  +--::xounit::TestResultsTextFormatter
Associated Test:
::xounit::test::TestTestFailuresTextFormatter

Class TestFailuresTextFormatter
superclass ::xounit::TestResultsTextFormatter,
Format test failures and errors for display in text.
Variables
NameDefault ValueClassComment
 
Methods
NameComment
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
printResult {aResult}   Format one TestResult and return the string
   
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

numberOfErrors

Description:
 Count the total number of test errors.
Arguments:
Overrides:
numberOfErrors in ::xounit::TestResultsTextFormatter
Code:
  ::xounit::TestFailuresTextFormatter instproc numberOfErrors {results}  {
   

        set number 0

        foreach result $results {

            incr number [ $result numberOfErrors ]
        }

        return $number
    
}

numberOfFailures

Description:
 Count the total number of test failures.
Arguments:
Overrides:
numberOfFailures in ::xounit::TestResultsTextFormatter
Code:
  ::xounit::TestFailuresTextFormatter instproc numberOfFailures {results}  {
   

        set number 0

        foreach result $results {

            incr number [ $result numberOfFailures ]
        }

        return $number
    
}

numberOfPasses

Description:
 Count the total number of tests that passed.
Arguments:
Overrides:
numberOfPasses in ::xounit::TestResultsTextFormatter
Code:
  ::xounit::TestFailuresTextFormatter instproc numberOfPasses {results}  {
   

        set number 0

        foreach result $results {

            incr number [ $result numberOfPasses ]

        }

        return $number

    
}

numberOfTests

Description:
 Count the total number of tests run.
Arguments:
Overrides:
numberOfTests in ::xounit::TestResultsTextFormatter
Code:
  ::xounit::TestFailuresTextFormatter instproc numberOfTests {results}  {
   

        set number 0

        foreach result $results {

            incr number [ $result numberOfTests ]
        }

        return $number

    
}

printError

Description:
 Format a TestError
Arguments:
Overrides:
printError in ::xounit::TestResultsTextFormatter
Code:
  ::xounit::TestFailuresTextFormatter instproc printError {anError}  {
   

        return "Error: [ $anError name ] [$anError test]
[$anError error]\n\n"
    
}

printFailure

Description:
 Format a TestFailure
Arguments:
Overrides:
printFailure in ::xounit::TestResultsTextFormatter
Code:
  ::xounit::TestFailuresTextFormatter instproc printFailure {aFailure}  {
   

        return "Failure: [ $aFailure name ] [$aFailure test]
[$aFailure error]\n\n"
    
}

printResult

Description:
 Format one TestResult and return the string.
Arguments:
Overrides:
printResult in ::xounit::TestResultsTextFormatter
Code:
  ::xounit::TestFailuresTextFormatter instproc printResult {aResult}  {
   

        set buffer ""

        if { [ $aResult passed ]} { return }

        append buffer "Test Results: [ $aResult name ]\n"

        foreach error [ $aResult errors ] {

            append buffer [ my printError $error ]
        }

        foreach failure [ $aResult failures ] {

            append buffer [ my printFailure $failure ]
        }

        #append buffer "Errors : [ $aResult numberOfErrors ]\n"
        #append buffer "Failures : [ $aResult numberOfFailures ]\n"

        return $buffer

    
}