There's a lot of talk about SeeAllData being something to always avoid for best practice. My understanding is, if you're using it to test, for example, a Contact Trigger on a specific Contact, this is terrible practice, because you can't/shouldn't rely on specific data points like that.
In an example scenario that I'm going through right now, an email is sent in my code, and the email address is set with a Custom Setting field.
My test is failing, because it doesn't have visibility into the custom settings (my assumption*). In this case, would I not need SeeAllData? Is this bad practice? If so, what is the proper way to operate this test class instead? Is the reliance on the custom setting in itself the bad practice?
Looking for advice, because the way I see it, there are certain reasons why you might need SeeAllData which exploit the fact that you're not using best practice, but I don't think using it in itself is bad (I mean, it exists to use in the first place for a reason, right?) Thoughts?
I figured using custom settings for the email address is great because otherwise, I'm hard-coding and email address (one that should be something else in Test so that it doesn't spam when we're testing). But now I'm wondering if it's bad practice since it technically is relying on the database...
*my test fails saying the email address is null and can't send the message. I use SeeAllData, and it sends.
Bonus: While on the topic, what are valid uses of SeeAllData? Every resource I find explains why it's terrible to use, but I think it depends on why you need it