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, however, is cumbersome and time consuming. Therefore, a tool has been developed that will assist 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 will be executed and the output parameters appear on the screen.

Procedure

To test a protected method, take the following steps:

  1. Start the BOL Test Tool _ Protected Layer (tlbct2210m000) session. To start this session, on the Tools menu, point to Application Development and click Business Object Modeling.
  2. Enter 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 enter the actual values of the input arguments, you must specify the arguments that will be sent to the protected layer.
  4. Enter the input arguments values in the BOL Test Tool – Tester part two. After you click Test, the method will be executed and the result appears on the screen automatically.
  5. View the result of the method execution in the BOL Test Tool – Tester part three, which shows the output argument values or the return value and error message.

For details on these steps, refer to the BOL Test Tool - Launcher and BOL Test Tool – Tester.

BOL Test Tool - Launcher

For details on the BOL Test Tool - Launcher, click the following link: BOL Test Tool - Protected Layer (tlbct2210m000)

BOL Test Tool – Tester

Via the BOL Test Tool Launcher (BOL Test Tool - Protected Layer (tlbct2210m000) 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) appear, in which you can specify input arguments and their values and view the results.

The screens of these sessions have the following structure:

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

The following figure shows an example of the first temporary session:

BOL Test Tool – Tester part one

BOL Test Tool – Tester part one

Define the input arguments to be used. Click Continue to go to the next screen.

The following figure shows an example of the second temporary session:

BOL Test Tool – Tester part two

BOL Test Tool – Tester part two

Enter the input arguments values.

You only have to enter the input parameters values and click Test to run the method and see the result of the output arguments, return value, and error message.

The following figure shows an example of the third temporary session:

BOL Test Tool – Tester part three

BOL Test Tool – Tester part three

Click Continue to go back to the first screen.

Hinweis

Each time you click Cancel (or ESC) followed by Launch again, a complete new test program is generated. For this reason, use Continue whenever possible to reuse the current test object.

Supported features
  • Mandatory 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 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 will be reported by means of a message.
  • Text fields appear 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:

[...]

The following 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, for example, to monitor the program flow, and to edit, compile and run the generated test script manually. Refer to BOL Test Tool - Protected Layer (tlbct2210m000) for details.

To start the test tool in developers mode, you must add the following 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

The following files are created on the $BSE_TMP directory:

FileDescription
tmpdddddddddFile generated by the bshell via the function creat.tmp.file$( bse.tmp.dir$() )Example: tmp057080500
tmpddddddddd.objObject file generated by the compiler
tmpddddddddd.errError file generated by compiler in case of compilation errors or warnings

 

Program Flow
[...]