TTestCase Object
Methods
A test case defines the fixture to run multiple tests.

Unit
TestFramework

Declaration
TTestCase = class(TAbstractTest, ITest)

Description
To define a test case
1) implement a subclass of TestCase
2) define instance variables that store the state of the fixture
3) initialize the fixture state by overriding setUp
4) clean-up after a test by overriding tearDown.
Each test runs in its own fixture so there can be no side effects among test runs. Here is an example:
  interface

  type
    TMathTest = class(TTestCase)
    private
      fValue1,
      fValue2: Float;
      procedure testAdd;
    public
      procedure setUp; override;
    end;

  implementation

  procedure TMathTest.setUp;
  begin
    fValue1 := 2.0;
    fValue2 := 3.0;
  end;
For each test implement a method which interacts with the fixture. Verify the expected results with tests specified by calling check with a boolean and an optional message.
  procedure TMathTest.testAdd;
  var
    testResult: Float;
  begin
    testResult := fValue1 + fValue2;
    check(testResult = 5.0);
  end;
see TTestResult see TTestSuite

Introduced Methods
Check  Checks that a condition is met.
CheckEquals
CheckNotEquals
CheckNotNull
CheckNull
CheckSame
Create  Create an instance of a test fixture to run the named test.
EqualsErrorMessage
Fail  Report a test failure.
FailEquals
FailNotEquals
FailNotSame
NotEqualsErrorMessage
NotSameErrorMessage
Run
RunBare  Runs the test case and collects the results in TestResult.
RunTest  Perform the test.
SetUp  Sets up the fixture, for example, open a network connection.
StopTests  Stops testing.
Suite  Create a test suite.
TearDown  Tears down the fixture, for example, close a network connection.


HTML generated by Time2HELP
http://www.time2help.com