::xounit::test
Class TestCatchAndReport

Heritage:
::xotcl::Object
  |
  +--::xox::Node
        |
        +--::xounit::Test
              |
              +--::xounit::Assert
                    |
                    +--::xounit::TestCase
Class TestCatchAndReport
superclass ::xounit::TestCase,

Variables
NameDefault ValueClassComment
currentTestMethod    ::xounit::TestCase
 name of the currently running test method.
nodeName    ::xox::Node
 
result    ::xounit::TestCase
 the result for the current run.
 
Methods
NameComment
testError {}  
testFail {}  
testScope {}  
testSimple {}  
   
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

testError

Description:
 
Code:
  ::xounit::test::TestCatchAndReport instproc testError {}  {
   

        set test [ ::xounit::TestCase new ]

        set result [ $test newResult ]
        puts [ $result info class ]

        $test result $result
        $test currentTestMethod testFail

        $test catchAndReport { 

            error "Passed"
        }

        puts [ $result info class ]
        
        my assertFalse [ $result passed ]
        my assertEquals 1 [ llength [ $result errors ] ] 
        my assertEquals 0 [ llength [ $result failures ] ] 
        my assertEquals 0 [ llength [ $result passes ] ] 
        my assertEquals 1 [ llength [ $result tests ] ] 
    
}

testFail

Description:
 
Code:
  ::xounit::test::TestCatchAndReport instproc testFail {}  {
   

        set test [ ::xounit::TestCase new ]

        set result [ $test newResult ]
        puts [ $result info class ]

        $test result $result
        $test currentTestMethod testFail

        $test catchAndReport { 

            my fail "Passed"
        }

        puts [ $result info class ]
        
        my assertFalse [ $result passed ]
        my assertEquals 0 [ llength [ $result errors ] ] 
        my assertEquals 1 [ llength [ $result failures ] ] 
        my assertEquals 0 [ llength [ $result passes ] ] 
        my assertEquals 1 [ llength [ $result tests ] ] 
        my assertEquals Passed [ $result . failures . error ] 
    
}

testScope

Description:
 
Code:
  ::xounit::test::TestCatchAndReport instproc testScope {}  {
   

        set a 0

        my catchAndReport { 

            set a 5
        }
        my assertEquals 5 $a 
    
}

testSimple

Description:
 
Code:
  ::xounit::test::TestCatchAndReport instproc testSimple {}  {
   

        my catchAndReport { 

        }
    
}