What is an assertion?
An assertion is an executable check for a property that must be true of the code.
Assertions Aren't For Error Handling (that's what exceptions are for)
- Assert something about the result of your logic
- Don't assert anything about the result of another entity's logic
No Side Effects
- Assertions shouldn't change the state of any variables outside the scope of the assertion
No Silly Assertions
- Check for errors in your own logic
- Don't check if the user did something wrong (in the assertion)
- Don't check that any other entity is working correctly
From Udacity's Software Testing