OEUnit - Unit Testing Framework |
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:
OEUnit.Runner.TestSuite
.ROUTINE-LEVEL ON ERROR UNDO, THROW
statement.
Not using this statement can cause test failures to be recorded as passes.
1. Create a class that inherits from OEUnit.Runner.TestSuite
like the class below SimpleSuite.cls
:
ROUTINE-LEVEL ON ERROR UNDO, THROW. CLASS SimpleSuite INHERITS OEUnit.Runner.TestSuite: END CLASS.
2. Add a constructor to the class:
ROUTINE-LEVEL ON ERROR UNDO, THROW. CLASS SimpleSuite INHERITS OEUnit.Runner.TestSuite: CONSTRUCTOR SimpleSuite(): END CONSTRUCTOR. END CLASS.
3. Inside the constructor, add some test cases. Each of these test cases will be run when the test suite is run:
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.
Test suites annotated with @Ignore
will not be run by the test runner. The @Ignore
annotation is useful for temporarily disabling test suites.
Syntax:
@Ignore.
Example:
1. Ignore an entire test suite:
ROUTINE-LEVEL ON ERROR UNDO, THROW. @Ignore. CLASS SimpleSuite INHERITS OEUnit.Runner.TestSuite: CONSTRUCTOR SimpleSuite(): AddTest(NEW SimpleTestCase1()). AddTest(NEW SimpleTestCase2()). END CONSTRUCTOR. END CLASS.