A simple example: if I wrote a function, add(x, y), I would want to test that it behaved as expected. So, I'd write a test (among others) to assert that add(4,5) returned 9. I would also test things like add(null, 5) to make sure that my code gracefully handled error conditions.