Batch Test code refactored