7

we have quite a lot of RPG-programs here, and we do a lot of automated testing, but we are not very good yet in combining those two. Are there good ways to do automated testing on RPG programs -- or on any other ILE programs for that matter?

I am aware of a project named RPGUnit, but that has it's last update in 2007. However, it seems it is still used, since RPG Next Gen is currently putting some work in including it.

What's you experience with those? Is there something else, that I am missing, like some great sofware tool google fails to find?

I'm interested in unit testing as well as integration testing of complete projects. Anything that integrates with tools like jenkins is welcome. If it involves IBM's Rational Developer or System i Navigator, that's okay, too.

We are in an early phase of creating new testing plans for our RPG development process, and I don't want it, to head in the wrong direction right from the start.

kratenko
  • 7,354
  • 4
  • 36
  • 61
  • 2
    Probably the bigger question is... do you have the _architecture_ for unit testing? The language seems to actively encourage writing programs in a way that makes good encapsulation difficult (ie - programs containing everything from database access up to screen output, in one file). – Clockwork-Muse Jun 20 '12 at 16:07
  • @X-Zero if you choose to do so, you can have seper – WarrenT Jun 21 '12 at 01:34
  • @x-zero ILE Moduled can give encapsulation, even anong different languaged, all bound into one program – WarrenT Jun 21 '12 at 02:53
  • @WarrenT - Yes, it can. But you have to actively write your programs to take advantage of that fact. Tradition seems to dictate that everything be in one file, and given how resistant some businesses can be to change. And with ILE modules, you have to be careful, or procedures can appear to come out of nowhere (here, there's a few programs without any includes or anything, it's solely handled by the activation group, meaning you have to search the entire codebase to find the method...) – Clockwork-Muse Jun 21 '12 at 15:39
  • 1
    '...you have to actively write your programs to take advantage of that fact...' This is true for all languages, all platforms. The faults of the programmer are not the faults of the language. '...it's solely handled by the activation group...' This is not quite accurate. Sometimes, a programmer (see above) will bind a procedure by copy, and do so via CRTPGM MODULE() rather than bind by reference (service program) and a binding directory. Too often, the programmer has chosen a naming convention that makes it difficult to know what source member a given procedure comes from. Bad programmer – Buck Calabro Jun 22 '12 at 14:47
  • @X-Zero Yes, I know about those problems, and in many parts we don't. Still we want to get there with new projects, but that is not so easy, if we don't find a way to fill the gap I tried to put in my question. – kratenko Jun 22 '12 at 14:51
  • @kratenko Don't bind by copy except for service programs. Use a make script for them. For programs, use a binding directory H spec. Name the module, the source member and the include file the same. Module in QRPGLESRC, include in QPROTOSRC. All names match, easy to locate. Searching for a specific proc? Scan QPROTOSRC; the member having that proc will have a corresponding member in QRPGLESRC which has the procedure code. – Buck Calabro Jun 22 '12 at 14:55
  • @Buck Thanks for the tips. That's close to how I try to code my RPG anyway. But it doesn't really help with my problem. – kratenko Jun 22 '12 at 16:04

2 Answers2

5

You probably already know how broad a subject 'testing' can be. IBM have a product called Rational Function Tester (I haven't used it) http://www-01.ibm.com/software/awdtools/tester/functional/ I myself use RPGUnit. No, it hasn't been updated recently but it still has all the pieces needed for testing subprocedures in the same way one would test Java methods.

Frankly, that's the easy part. The hard part is creating a test database and keeping it current enough to be representative of the production database. Rodin have some database tooling but I haven't the budget for those, so I roll my own more or less by hand. I use many SQL statements in a CL program to extract production data so I can maintain referential integrity. Then I use some more SQL to add my exceptional test cases - those relationships which aren't present in the production data but need to be tested for. Then I make a complete copy of the test database as a reference point. Then I run my test cases, which will update the test database. I've written a home grown CMPPFM utility that will allow me to compare the reference database against the now modified test database. This will show changes, but it still needs a lot of manual labour to review the comparisons to ensure that the proper rows got the proper updates. I haven't gone the extra mile to automate that yet. One big caveat is there are some columns you don't care about, like a change timestamp.

Buck Calabro
  • 7,558
  • 22
  • 25
  • Thanks for the insight so far. So RPGUnit is usefull, that's the good part to hear. From its feature list, the Functional Tester does not look to have any RPG or ILE functionality, it only has the "other parts" to organise the tests (I don't think we'll buy something for that part). – kratenko Jun 22 '12 at 14:49
  • since this is a good answer and it does not look I'll get something more to this, I might as well accept it... – kratenko Jun 04 '14 at 14:38
5

We went with RPGUNIT, and found it a good base to work from, but ended up extending it a lot to tie in with our Change Management system, and the way we work. I've written about the things we tried here: http://www.littlebluemonkey.com/blog/my-rpg-unit-test-journey

  • Thanks for letting us participate in your journey. Looks like you succeded in doing it! It will be helpful once we decide to put the time in doing real RPG testing. – kratenko Jun 24 '14 at 09:27