Refactored test infrastructure