Changed error message on failure and made test more robust

Better error message