Unit test case are useful for validate a piece of code. where it is returning expected output or not.lets take following example.
In megento we have customer login module. today i wrote some test cases and executed. after some days i have changed some functionality related to customer login module. now i need to check all the scenarios. In that case i go and run all the existing scenarios and check all are valid or not. it means we can validate immediately whatever changed functionality effecting existing scenarios or not. this it main advantage of test cases. we are maintaining set of records to validate particular module/functionality.
lets take login module, by default we have authenticate($username, $password) in AccountManagement.php and test case also available for this authenticate method
Now i added new functionality like login with "username"/"mobile number" or email. instead of only email. now i added test case for newly added functionality. now it is working fine. after that i need to cross verify existing all the scenarios whether is any thing effected of not.