Minor code reorganization in testcase