Testing Error Cases and Failing Early | Go Tests #2

Опубликовано: 15 Октябрь 2024
на канале: kubucation
3,366
116

What is failing early and why should you care? Sometimes it doesn't make sense to continue running a test if one of the first assertions already failed. For example if you want to test for the "name" field of a "Post" object, but already identified that your post is nil/null, you're in for trouble. This also becomes relevant when testing for error cases. In this second video of our Golang Testing Series, we're covering both how to test for errors as well as how to abort the execution of a test early if a condition is not met.