Some refactoring in test code.

Signed-off-by: Jim Teeuwen <jimteeuwen@gmail.com>