How to unit test a module?

10 pts.
Hi, I have done some enhancements in the existing module. for that i wolud like to do a unit test any one can help me out to describe how we can unittest a module .

Answer Wiki

Thanks. We'll let you know when a new response is added.


A module is simply a component of a program, so after making changes and recompiling it you have to recreate the program(s) that it is a part of.

How you test the changes made to the module depends on the functionality of the program and the changes made.

Best regards


Different modules make a product and different units make a module, so to run a unittest on a module, first of all it is very important to identify the units (module divided into sub-modules and sub-modules divided into further smaller components or units). Once these basic components or units are identified in a sub-module, each of it is to be functionally tested as per the requirements of this unit. Any business rule embedded in a unit has to be tested as per its accuracy. So in unit testing your test cases will be focusing on the functionality (requirements and rules) of each unit and unit test will be nothing but the verification process that all is working well as per requirements.

You can also use the UPDPGM command (update program), instead of recreating the program. This is useful if you have a program which contains several modules, and you want to replace just the module that was actually changed.

Discuss This Question: 1  Reply

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • Alopez1571
    Hi, First of all you have to understand these ILE concepts: Program - Module - Procedure 1) Procedure is the "callable" unit, by the instruction CALLB or using prototype with CALLP. There can be more than one procedure per source member. 2) Module is in OneToOne relationship with source member but could contain more than one procedure. It's the "compilable" unit. 3) Program is like the container of modules and procedures. Modules (which has procedures) are binded into a program or service program. For example: I have the program The Service program PayRollCal with the modules SalaryCal and Deductions. The first module has the procedures GetGrossSalary & GetOvertimeSalary, the second one has procedures GetTaxAmt & GetLoanDed. If I want to test the procedure GetTaxAmt which procedure interface is: D GetTaxAmt PI 13 2 D EmpCode 6 0 Value D GrossSalary 13 2 Value You create a program where you define this prototype: D GetTaxes Pr 13 2 Extproc('GetTaxAmt') D 6 0 Value D 13 2 Value The prototype is for making the call easier and it must match the procedure interface of the procedure to be called. Note the prototype name is different to the real procedure name, it is allowed but if you want to, you can use the same name and omit the ExtProc keyword. The call instruction could be: C Eval MyTaxes = GetTaxes(mycode:mysalary) Or for free format myTaxes = GetTaxes(mycode:mysalary); If you want to debug the procedure, you just have to start debuging the Test Program and add the services program by F14 function key, look for the corresponding module and visualize it to get into the code and press F6 at the line where you want to create a break point. I hope it can be helpful, Regards, Arturo Lopez
    150 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: