Remove duplicated code in integration tests