::xounit::test
Class TestAction

Heritage:
::xotcl::Object
  |
  +--::xox::Node
        |
        +--::xounit::Test
              |
              +--::xounit::Assert
                    |
                    +--::xounit::TestCase
Tested Class:
::xounit::Action

Class TestAction
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
test {}  
testError {}  
testFailure {}  
   
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

test

Description:
 
Code:
  ::xounit::test::TestAction instproc test {}  {
   

        my instvar actor

        set actor [ ::xounit::TestCase new ]
        $actor mixin ::xounit::Action

        $actor proc doSomething { } {

            return 5
        }

        my assertEquals [ $actor doSomething ] 5

        set result [ $actor executeActionReturnResult doSomething ] 

        #my debug [ $result dumpTreeData ]
        my assertEquals [ ${result}::TestPass return ] 5
    
}

testError

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

        my instvar actor

        my test

        $actor proc doError { } {

            error "An error occurred"
        }

        my assertError { 

            $actor doError
        }

        set result [ $actor executeActionReturnResult doError ] 

        #my debug [ $result dumpTreeData ]
        my assertEquals  [ ::xox::first [ split [ ${result}::TestError message ] "\n" ] ]  "An error occurred"
    
}

testFailure

Description:
 
Code:
  ::xounit::test::TestAction instproc testFailure {}  {
   

        my instvar actor

        my test

        $actor proc doFailure { } {

            my fail "I failed"
        }

        my assertFailure { 

            $actor doFailure
        }

        set result [ $actor executeActionReturnResult doFailure ] 

        #my debug [ $result dumpTreeData ]
        my assertEquals  [ ${result}::TestFailure message ]  "I failed"
    
}