Refactor codes in DeleteTest