Paul Hammant's Blog: Legacy TDD - RPG is not always a role playing game
OK, so I am doing a stint of work on an AS400 for a major internet bank. The things you have to do for ThoughtWorks! We quickly realized that you cannot unit test RPG. You can integration test it though...
Select "Whoa, some bad thing happened after that run"
group by someContrivedGroupClause
Select // another select based test that uses 'exists' or 'in', or 'not exists' etc.
Select // yet another test
Setup is done before the module invocation, and also using SQL directly. Copy some files (tables) to QTEMP that the RPG module thinks it is going to use, then insert failing (and passing) data into them, before the module call.
The last dynamic, is how to report failures. We've coded a C# unit test framework that leverages an abstraction layer written in Visual RPG, that calls the test CL program on the 400. We can then consume test results into a regular CC.Net page. The trouble is that in terms of y = mx + c, c is quite small and m is a few seconds so we have not enabled it yet. Some form of result collection strategy is called for.
For the record we could have done that last in Java with IBM's JTOpen for poking the 400. The bank is a C# shop though, so despite being a more natural fit with the 400 (you can even run Java on it), it would not fly.
All fun, apart from source entry utility (SEU). It sucks, there is no editor worse!
blog comments powered by Disqus