Writing a Test Suite




What is a test suite?   Top

A test suite is a class that contains a list of test cases and/or other test suites. Test suites are useful for grouping and organising test cases.

Important Notes:

 

How to write a simple test suite   Top

1. Create a class inheriting from OEUnit.Runner.TestSuite:

 ROUTINE-LEVEL ON ERROR UNDO, THROW.

 CLASS SimpleSuite INHERITS OEUnit.Runner.TestSuite:
 END CLASS.


2. Add a constructor:

 ROUTINE-LEVEL ON ERROR UNDO, THROW.

 CLASS SimpleSuite INHERITS OEUnit.Runner.TestSuite:
   
   CONSTRUCTOR SimpleSuite(): 
   END CONSTRUCTOR.     

 END CLASS.


3. Add some test cases to the suite:

 ROUTINE-LEVEL ON ERROR UNDO, THROW.

 CLASS SimpleSuite INHERITS OEUnit.Runner.TestSuite:
   
   CONSTRUCTOR SimpleSuite():

     AddTest(NEW SimpleTestCase1()). 
     AddTest(NEW SimpleTestCase2()).

   END CONSTRUCTOR.
       
 END CLASS.


4. To run the test suite, see Running a Test.



Cameron Wills, October 2008.