More factoring out of common test code