Running a Test

Running a test from the Editor Context Menu

If you're using Progress Developer Studio (previously OpenEdge Architect), and have followed the instructions in Installation Step 4: Add a Context Menu item , this is the recommended method to run a test.

1. In Progress Developer Studio, open the test case or test suite you wish to run.

2. From the ABL Editor, right click to open the context menu and then click Extensibility > Run As Test.

ABL Editor Context Menu


3. The test will run in the background. Once its finished, the results should appear in a new view (similar to below).

Test Results Window

Running a test from code

There are two options for running a test from code:

Option 1. Using the OEUnit.Runners.RunTest helper (runs the test and displays the results):

 ROUTINE-LEVEL ON ERROR UNDO, THROW.

 USING OEUnit.Runners.RunTest.

 /* Create an instance of your test case class */
 DEFINE VARIABLE test AS SimpleTest NO-UNDO.
 test = NEW SimpleTest().
 
 /* Run your test with the default 'runner' - runs all tests and displays the results */
 RunTest:WithDefault(test).

 /* Delete the test case instance */
 FINALLY:
   DELETE OBJECT test NO-ERROR.
 END FINALLY.


Option 2. Using a runner directly (better choice if you wish to inspect the results in code) :

 ROUTINE-LEVEL ON ERROR UNDO, THROW.

 USING OEUnit.Runners.OEUnitRunner.

 /* Create an instance of your test case or suite */
 DEFINE VARIABLE suite AS SimpleSuite NO-UNDO.
 suite = NEW SimpleSuite().
 
 /* Create an instance of the runner */
 DEFINE VARIABLE runner AS OEUnitRunner NO-UNDO.
 runner = NEW OEUnitRunner().

 /* Run your test case or suite */
 runner:RunTest(suite).

 /* Display the results */
 MESSAGE runner:Results:ToString() VIEW-AS ALERT-BOX.

 /* Delete the test and runner */
 FINALLY:
   DELETE OBJECT suite NO-ERROR.
   DELETE OBJECT runner NO-ERROR.
 END FINALLY.