Refactor test cases: moved common routines into iproc module.