Introduction
Exception testing checks if your program correctly handles errors. It makes sure your code reacts safely when something goes wrong.
When you want to confirm your code throws the right error for bad input.
When you need to check that your program does not crash unexpectedly.
When you want to verify that error messages are clear and helpful.
When testing how your code behaves with missing or invalid data.
When ensuring your program recovers or stops safely after an error.