Unit testing RPG with iRPGUnit: failures, errors, and running tests in CI
Legacy RPG is usually verified by hand, which breaks down when rules change later and no one recalls which records confirmed them. The iRPGUnit framework brings unit testing to RPG, and the author demonstrates it with a 20-test suite on PUB400 running IBM i 7.5. Business rules must sit in procedures free of file, record, or screen I/O to be testable, so the author moved accounts receivable payment logic into a service program with no I/O. A failing assertion stops its test case early, so keeping tests small and ordering cheap checks first helps. The article distinguishes failures, where code returns a wrong result, from errors, where code crashes, and shows how to test for expected exceptions.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in