refactored sptest automation