Debugging Test Cases

Debugging test cases is not as simple as debugging a standard RPG program from the command line, because you do not know the job, which runs the test case. It could be any QZRCSRVS job of the System i. Therefore you cannot start a service job and hence you cannot start the debugger.

The solution for that problem is “Service Entry Points” (SEPs). SEPs let you debug a batch program without knowing the job. Even the user profile may be unknown.

In order to set a SEP, you must right click on the service program that is your iRPGUnit test suite and select “Debug (Service Entry)” to set a service entry point.

iRPGUnit Set SEP

Then make sure, that the iRPGUnit plug-in is in debug mode:

iRPGUnit Debug Mode Enabled

Debug mode is enabled, when the little green bug at the top right corner of the iRPGUnit view is pressed.

Note: When debug mode is disabled, the RDi freezes, when the program reaches the SEP!

Now run your test case as usual. When the program reaches the SEP, you get a message that you need to answer with “Yes” in order to start a debug session:

iRPGUnit Confirm SEP

Afterwards you can set your breakpoints and debug the unit test.