generate token until 10 attempts
Fix test cases format