ILEUnit - Unit Test Framework for ILE enabled languages

Getting Started

The source can be fetched from the project page on Bitbucket. The sources are stored and packaged as stream files. So they need to be stored in the IFS. Clone the source directly from Bitbucket:

            git clone https://bitbucket.org/m1hael/ileunit
	
or
            git clone git@bitbucket.org:m1hael/ileunit.git
	

It is best to have a separate folder for the copybooks/include files.

	mkdir /usr/local/include
	

Prerequisites

The unit testing framework relies on the following packages:

 

You can get these packages from the download section at rpgnextgen.com and from Bitbucket.

Compilation

To compile the source it is best to enter the QShell (enter QSH). The script to be used for building the framework is a Makefile. To check if the tool make is installed just enter which make. The Makefile is a simple text file with build instructions for the make tool. It can be edited like any other stream file.

The Makefile has some variables like the destination library for the compiled binaries, the binding parameters for the service program and the destination folder for the include files.

The variable can be simply overridden.

	make BIN_LIB=PRODLIB INCDIR=/usr/other/local/include all
	

Note: Make sure to have LLIST and REFLECTION accessable from your library list.
 

Include Files

The unit tests need some files to be included (copy books) from the ILEUnit framework. To install them in your include folder use the make tool.

	make BIN_LIB=PRODLIB INCDIR=/usr/local/include install
	

Test

The ILEUnit package comes with a very simple unit test, see unittest folder. Unit tests can be directly created from stream files.

	IUCRTTST TSTPGM(YOUR_LIB/ILEUNIT_01) SRCSTMF('/usr/local/src/ileunit/unittest/ileunit_01.rpgle') 
		INCDIR('/usr/local/include')
	

To run the simple unit test use the IURUNTST command.

	IURUNTST TSTPGM(YOUR_LIB/ILEUNIT_01)
	

The output should be: Success. 1 test case, 3 assertions, 0 failure, 0 error.

Congratulations! You installed and tested the unit testing framework ILEUnit. Happy testing =)