How to test protected methods for LN

This topic describes how you can test the protected layer of the BOL software before you expose the layer to the outside world.

Introduction

Using the Business Object Layer (BOL), LN is open towards other ERP components and other external software. Before you expose the BOL software to the outside world, you must test the code to assure quality. One way to test this code is to write test code that calls the methods. This process is cumbersome and time consuming. Therefore, a tool has been developed that assists the engineer when performing this task.

The test utility enables the ERP software engineer to test a protected BOL method by specifying the Business Object and method name. The tool analyzes the BOR and asks for the value of the input parameters. If you click Test, the method is executed and the output parameters are displayed on the screen.

Procedure

To test a protected method:

  1. Start the session. To start this session, on the Tools menu, point to Application Development and click Business Object Modeling.
  2. Specify the Business Object and method name you want to test in the BOL Test Tool - Launcher. After you click Launch, the actual test program is generated and activated.
  3. Define the input arguments to be used in the BOL Test Tool – Tester part one. Before you specify the actual values of the input arguments, you must specify the arguments to be sent to the protected layer.
  4. Specify the input arguments values in the BOL Test Tool – Tester part two. After you click Test, the method is executed and the result is displayed on the screen automatically.
  5. View the result of the method execution in the BOL Test Tool – Tester part three. This session shows the output argument values or the return value and error message.

BOL Test Tool - Launcher

For details on the BOL Test Tool - Launcher, click this link:

BOL Test Tool – Tester

In the session, you have specified which method from which Business Object to test. Based on this information, a specific test program performs the actual test. Three temporary sessions (BOL Test Tool – Tester parts one through three) are displayed. In these sessions, you can specify input arguments and their values, and view the results.

The screens of these sessions have this structure:

  • Title bar that contains information about the session, object, and method
  • Input / output arguments (output: Read-only)
  • Return value and (DAL) error message

Complete these steps:

  1. In the first temporary session, define the input arguments to be used.

    For example, you specify the orderCode argument.

  2. Click Continue to go to the next screen.
  3. In the second temporary session, specify the values of the input arguments.

    For example, you specify A10000001 as value for the orderCode argument.

  4. Click Test to run the method.
  5. The third temporary session starts.

    In this session, you can view the result of the output arguments, return value, and error message.

    For example, the orderQuantityValue and plannedDeliveryDate and other properties of order A10000001 are displayed.

  6. Click Continue to return to the first screen.
    Note: Each time you click Cancel (or ESC) followed by Launch again, a complete new test program is generated. Therefore, use Continue whenever possible to reuse the current test object.

Supported features

  • Required fields are marked with an asterisk (*).
  • Type information is linked to fields ([long], [double], [string], and so on).
  • In case of an item field (argument that is linked to the tcitem domain), you can zoom to the Items - General (tcibd0501m000) session. To enter a field with a blank item segment, you MUST use this zoom session to have a workaround for a known tools issue.
  • Transactions are supported. If the return value of the method is not zero (‘0’) the transaction is stopped; in all other cases, a commit is made. If a retry must be made, this is reported through a message.
  • Text fields are displayed in a window of five lines of 60 characters in length (only as output fields; so not as input field). The reason for this is because, in LN, you must work with text numbers.
  • If you press ESC or click Cancel in the BOL Test Tool – Tester, you immediately return to the BOL Test Tool – Launcher.

Company handling

The tool must deal with various data sets ( companies) and can cause some confusion when you look at the bottom-right corner of the screen:

tlnt_screen_000010d.png

These datasets are used:

  • Company 000 (Tools company for the tt package). The BOL Test Tool - Launcher (BOL Test Tool - Protected Layer (tlbct2210m000) session) by definition, uses company 000. For the script information, the Function Tree database from the tl package is used.
  • Your current company. The generated test program uses this company (BOL Test Tool - Tester) to test the Business Object: for example, when you test the Create method of the Address business object, a new address record is inserted in your current company.
  • The company that contains the test related data. This company is specified in the Setup Tools-Addon (tlcom0200m000) session.

Developers mode

You can start the test tool in developers mode to control the test script that is run. In developers mode, the test tool provides various extra options. These options include monitoring the program flow, and editing, compiling and running the generated test script manually. See .

To start the test tool in developers mode, you must add this line to the Command field of your BW Configuration file:

-- -set TMODE=1

Note that you cannot add this line if you use the Infor ES Web UI interface.

Intermediate files

This table shows the files that are created in the $BSE_TMP directory:

File Description
tmpddddddddd File generated by the bshell through the function creat.tmp.file$( bse.tmp.dir$() )Example: tmp057080500
tmpddddddddd.obj Object file generated by the compiler
tmpddddddddd.err Error file generated by compiler in case of compilation errors or warnings

Program Flow

tltr_flow_000010.png