It would be nice to be able to use parameterized unit tests in iRPGUnit just like in other languages (like Java).
The idea is to create a set of data and execute a test with every data entry of the set.
The test writer would need to provide a procedure (unittest_provideData) which creates a list (module LLIST) of data entries and a procedure which receives one data entry for the next test case run (unittest_setData).
I have created a first prototype which identifies the parameterized test by the existence of the procedure unittest_provideData, see module CMDRUN. There the test data provider is called and the data set.
This prototype needs more work on the output (spooled file and userspace). Perhaps a version 4 interface for the userspace? I think the only thing we need to add to the userspace is the index of the test run. Though the question is if a single testcase instance of a parameterized testcase should be able to be rerun? Or is it enough to rerun the whole testcase?
I created a simple test case (PTEST1) with a test data provider (PTESTDTAPR) which are bound to a service program PTEST:
crtsrvpgm ptest module(ptest1 ptestdtapr) bndsrvpgm(rpgunit/rutestcase llist) export(*all)
I have attached source and test output.
Note: Some includes use absolute paths for more convenient development on my side :)