::xounit
Class Test

Heritage:
::xotcl::Object
Direct Known Subclasses:
::xounit::TestCase, ::xounit::TestSuite,

Associated Test:
::xounit::test::TestTest

Class Test
superclass ::xotcl::Object,
Test is the simplest possible test and base class for all 
 tests in xounit.  The simplest possible test does nothing.
 That is what Test does.  However it does provide a interface
 for Test subclasses to implement.  This allows the test
 runner to be ignorant of how the test runs, and can run
 multiple types of tests together in one batch.
Variables
NameDefault ValueClassComment
 
Methods
NameComment
?test {{prefix ""}}   Finds all test methods that are available on this Test
name {args}   Sets the name for the test
newResult {}   returns a new instances of TestResult
run {testResult}   run is the method that will be called by test runners when they run this test
runAlone {}   runAlone creates a new TestResult from newResult, runs this test, and returns the result
   
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:
 Finds all test methods that are available on this Test.
Arguments:
Code:
  ::xounit::Test instproc ?test {{prefix ""}}  {
   

        return [ my ?methods "test$prefix" ]
    
}

name

Description:
 Sets the name for the test.  If 
 no name is provided this method returns
 the name of the class.
Arguments:
Code:
  ::xounit::Test instproc name {args}  {
   

        if { [ llength $args ] == 0 } {

            if [ my exists name ] {

                return [ my set name ]
            }

            return [ my info class ]
        }

        return [ my set name [ lindex $args 0 ] ]
    
}

newResult

Description:
 returns a new instances of TestResult.
 Override this method if you need to create
 a special TestResult subclass for your Test subclass.
Code:
  ::xounit::Test instproc newResult {}  {
   

        return [ TestResult new -name [ my name ] ]
    
}

run

Description:
 run is the method that will be called by test runners
 when they run this test.  This method is meant
 to be overridden by subclasses and provides no
 functionality by default.
Arguments:
Code:
  ::xounit::Test instproc run {testResult}  {
   

    
}

runAlone

Description:
 runAlone creates a new TestResult from newResult,
 runs this test, and returns the result.  This
 is useful if you have created a Test instance
 and want to run the test without a test runner.
Code:
  ::xounit::Test instproc runAlone {}  {
   

        set result [ my newResult ]
        my run $result
        return $result
    
}