Test an External Subroutine

This section describes how to test an external subroutine. The tester can test the subroutine using either a subprogram or a program that calls a subprogram. The following tables describes which option to use:

External Subroutine Features Test Using
No parameters and screen input/output Program (Natural for Ajax provides the screen input/output)
Parameters and no screen input/output Subprogram (then you can use the subprogram tester to create scripts so the tests can be run again)

Note:
If there are parameters and no screen input/output, it is easier to test the routine as a subprogram because the subprogram tester can handle the variety of parameters.

Regardless of which option you use, temporary Natural objects are created to perform the tests and then deleted when the Natural for Ajax page or subprogram tester is closed.

Note:
If you intend to use the temporary subprograms to create a unit (batch) test for the subroutine, save the files locally before closing the tester.

The following topics are covered:


Access the Subroutine Tester

Start of instruction setTo access the subroutine tester

  1. Open the context menu for the subroutine in the Project Explorer view.

  2. Select Testing.

    The test options for external subroutines are displayed.

Test with a Program

Start of instruction setTo test an external subroutine using a program

  1. Open the context menu for the subroutine in the Project Explorer view.

  2. Select Testing > Test Subroutine with Program.

    The subroutine is tested and the results are displayed in the Natural I/O view. For example:

    graphics/natural-i-o-view.png

Test with a Subprogram

Start of instruction setTo test an external subroutine using a subprogram

  1. Open the context menu for the subroutine in the Project Explorer view.

  2. Select Testing > Test Subroutine with Subprogram.

    The tester creates a temporary subprogram file to test the subroutine. For example:

    graphics/test-subroutine-with-subprogram-editor-view.png

    Note:
    This editor functions in the same way as the editor used to test a subprogram. For information on using this editor, see Features of the Test Editors and Test a Subprogram Directly.