In DUnit, SetUp
and TearDown
are called before (and after, respectively) each test method is executed.
In SetUp
, I create an object that loads data from a file. This is slow, especially if I have many tests.
Is there any way to call SetUp
once, before executing ALL tests (and obviously the same for TearDown
)?
Asked
Active
Viewed 1,361 times
7
1 Answers
12
From the documentation:
TTestSetup
TTestSetup can be used when you wish to set up state exactly once for a test case class (the SetUp and TearDown methods are called once for each test method). For example, if you were writing a suite of tests to exercise some database code, you might subclass TTestSetup and use it to open and close the database before executing the suite.

Community
- 1
- 1

whosrdaddy
- 11,720
- 4
- 50
- 99