Updated test to check exit code and added test to check for failure