replace result testing by error code testing