DEV Community

Discussion on: Writing Good Unit Tests: A Step By Step Tutorial

Collapse
 
setagana profile image
setagana

Nice post, thanks Elena! Another tactic I like to use when creating unit tests is to scan my code for control flow statements and try think of the possible cases that can come from those. A great example of this is languages that allow you to fall through switch statements, where small code changes can lead to big headaches if they're not thought through.

Collapse
 
ice_lenor profile image
Elena

Thank you!
I absolutely agree with reading the code and looking for tricky places. I mentioned it in the "What's inside" section.
The switch falling-through is a really good example!