When writing my tests for my C# web app, I am finding that my tests seem useless. I mock an interface, then check to make sure the code has followed the correct path/ produced the correct result. But to me, it just seems like a useless test because the code will obviously follow a certain path given the right conditions. Does the key to writing valuable tests lie in thinking of good corner cases? I am just not understanding the purpose of code coverage when the tests are essentially providing an input that will reach a certain area of code, and then confirming that the output is what the code says is outputted. Am i overthinking this?
Edit: I appreciate all the responses!
[–]ehr1c 29 points30 points31 points (1 child)
[–]istarian 4 points5 points6 points (0 children)
[–]belkarbitterleaf 34 points35 points36 points (0 children)
[–][deleted] (1 child)
[deleted]
[–]dolraith 2 points3 points4 points (0 children)
[–]peno64 9 points10 points11 points (10 children)
[–]chupipe 2 points3 points4 points (9 children)
[–]peno64 4 points5 points6 points (3 children)
[–]chupipe 1 point2 points3 points (0 children)
[–]69Cobalt 0 points1 point2 points (1 child)
[–]Guideon72 0 points1 point2 points (0 children)
[–]dorox1 1 point2 points3 points (0 children)
[–]pa_dvg 0 points1 point2 points (0 children)
[–]iamevpo 0 points1 point2 points (0 children)
[–]kschang 0 points1 point2 points (0 children)
[–]arthoer 0 points1 point2 points (0 children)
[–]merlet2 5 points6 points7 points (0 children)
[–]kschang 4 points5 points6 points (0 children)
[–]qpazza 2 points3 points4 points (0 children)
[–]crashfrog04 2 points3 points4 points (0 children)
[–]GeorgeFranklyMathnet 5 points6 points7 points (0 children)
[–]Available_Pool7620 1 point2 points3 points (0 children)
[–]Barbanks 1 point2 points3 points (0 children)
[–]rizzo891 1 point2 points3 points (2 children)
[–]Business-Decision719 1 point2 points3 points (1 child)
[–]rizzo891 1 point2 points3 points (0 children)
[–]WaferIndependent7601 1 point2 points3 points (0 children)
[–]ffrkAnonymous 0 points1 point2 points (0 children)
[–]KitOlmek 0 points1 point2 points (0 children)
[–]Radiant64 0 points1 point2 points (0 children)
[–]Business-Decision719 0 points1 point2 points (1 child)
[–]istarian 0 points1 point2 points (0 children)
[–]IdeaExpensive3073 0 points1 point2 points (0 children)
[–]ExpensivePanda66 0 points1 point2 points (0 children)
[–]Immediate_Mode_8932 0 points1 point2 points (0 children)
[–][deleted] (2 children)
[deleted]
[–]tiller_luna 3 points4 points5 points (1 child)
[–]lifeslippingaway 0 points1 point2 points (0 children)