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
(see OpenEdge Development: ABL Reference). Not using this statement
can cause test failures to be recorded as passes.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.
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.