mgunit 1.2 API documentation

Unit testing framework for IDL

single page | use frames     summary     class     fields     routine details     file attributes

./

mguttestcase__define.pro


Subclass MGutTestCase to actually write tests. In a subclass of MGutTestCase, any function method whose name starts with "test" will be considered a test. Tests are executed and results are reported to the test runner object.

Examples

To write your own tests, simply subclass from this class and make methods that start with "test":

pro mytest::test_myroutine compile_opt strictarr answer = myroutine(1.0) ; answer should be 2. assert, abs(answer - 2.) lt 0.01, 'incorrect result, %f', answer return, 1 end pro mytest__define compile_opt strictarr define = { mytest, inherits MGutTaseCase } end

Class description for mguttestcase

Properties

npass get type=integer

number of passing tests

testnames get set type=strarr

array of method names which begin with "test"

nfail get type=integer

number of failing tests

failures_only init
nskip get type=integer

number of skipped tests

test_runner init
ntests get type=integer

number of tests

Routines

mguttestcase::setup

Override in subclasses to perform setup actions before each test.

mguttestcase::teardown

Override in subclasses to perform teardown actions after each test.

mguttestcase::getProperty, npass=integer, nfail=integer, nskip=integer, ntests=integer, testnames=strarr

Get properties of the object.

mguttestcase::setProperty, testnames=strarr

Set properties of the object.

mguttestcase::cleanup

Free resources.

result = mguttestcase::init(test_runner=object [, /failures_only])

Intialize test case.

mguttestcase__define

Define member variables.

Routine details

top mguttestcase::setup

mguttestcase::setup

Override in subclasses to perform setup actions before each test.

top mguttestcase::teardown

mguttestcase::teardown

Override in subclasses to perform teardown actions after each test.

top mguttestcase::getProperty

mguttestcase::getProperty, npass=integer, nfail=integer, nskip=integer, ntests=integer, testnames=strarr

Get properties of the object.

Keywords

npass type=integer

number of passing tests

nfail type=integer

number of failing tests

nskip type=integer

number of skipped tests

ntests type=integer

number of tests

testnames type=strarr

array of method names which begin with "test"

top mguttestcase::setProperty

mguttestcase::setProperty, testnames=strarr

Set properties of the object.

Keywords

testnames type=strarr

array of method names which begin with "test"

top mguttestcase::cleanup

mguttestcase::cleanup

Free resources.

top mguttestcase::init

result = mguttestcase::init(test_runner=object [, /failures_only])

Intialize test case.

Return value

1 for succcess, 0 for failure

Keywords

test_runner in required type=object

subclass of MGutTestRunner

failures_only in optional type=boolean

set to report only failed tests

top mguttestcase__define

mguttestcase__define

Define member variables.

File attributes

Modification date: Mon Oct 17 15:46:10 2011
Lines: 464
Docformat: rst rst