Unit testing:
http://wiki.developerforce.com/page/An_Introduction_to_Apex_Code_Test_Methods
http://wiki.developerforce.com/page/How_to_Write_Good_Unit_Tests
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_testing_unit_tests.htm
Testing Controllers and extensions:
http://www.salesforce.com/us/developer/docs/pages/Content/pages_controller_error_handling.htm
Running Unit Test Methods:
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_testing_unit_tests_running.htm
Cheers!!!