Added alerts to test

added alerts in if and else