Creating tests with dependencies on other tests

You can create tests that have different behavior depending on the outcome of other tests. For example, TSecondTest works only if TFirstTest runs and passes.

To allow this, place TFirstTest and then TSecondTest inside a TTestSequence. When the TTestSequence executes, the subtests run in order. To configure your test so that if a test fails, the remaining subtests do not run, you need to call SetHaltOnFail(kTrue) in your Setup member function. This technique works for both TTestSet and TTestSequence. The default value for SetHaltOnFail for TTestSet is False. For TTestSequence, the default value is True.

To ensure that your test has everything it needs to run, check the prerequisites by overriding Setup, and if you can't run a test, then throw an exception in Setup.


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker