Refactored test code to extract bootstrap functionality