Refactor the engine tests