Timeline for Where is the line between unit testing application logic and distrusting language constructs?
Current License: CC BY-SA 3.0
12 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jun 22, 2016 at 15:14 | comment | added | Robert Harvey | The attitude adjustment department is located here. | |
| Jun 22, 2016 at 13:35 | comment | added | Jonah | @Telastyn, I'm trying to gain insight about unit testing. My initial question was not clear enough, so I'm adding clarifications to steer the conversation toward my real question. You are choosing to interpret that as me somehow cheating you in the game of "being right." I have spent hundreds of hours answering questions on code review and SO. My purpose is always to help the people I'm answering. If yours isn't, that's your choice. You don't have to answer my questions. | |
| Jun 22, 2016 at 13:26 | comment | added | Telastyn | @jonah - welcome to the site. One of the key components of our Q&A format is that we're not here to help you. Your question helps you of course, but it also helps many other people who come to the site looking for answers to their questions. I answered the question you asked. It's not my fault if you don't like the answer or would rather shift the goalposts. And frankly, it looks like the other answers say the same basic thing, albeit more eloquently. | |
| Jun 22, 2016 at 11:39 | comment | added | Jonah | how about magical posters whose superpower is to avoid answering the question being asked under guise of virtuous preaching ? do those exist? | |
| Jun 22, 2016 at 10:56 | comment | added | Telastyn | @jonah - magical databases don't exist. Since you are not a unicorn, you test the unhappy paths. | |
| Jun 22, 2016 at 3:01 | comment | added | Jonah | @Telastyn, This is a magical database that cannot possibly error. However, it is possible that other developers on this project may decide to edit savePeople in some way. Do you still unit test it? If so, how? | |
| Jun 22, 2016 at 2:47 | comment | added | Robert Harvey | @Jonah: The title of the question states specifically that you're interested primarily in discussing the foreach language construct, and you're deflecting comments that have nothing to do with that. | |
| Jun 22, 2016 at 2:44 | comment | added | Telastyn | @jonah - should it iterate through and save as many as possible or stop on error? The single save can't decide that, since it can't know how it's being used. | |
| Jun 22, 2016 at 2:37 | comment | added | Jonah | @RobertHarvey, Please re-read the last paragraph of my OP, as your last comment is misrepresenting my position. I even gave the logical unit test and mocks that, imo, could reasonably be argued for. I am trying to get feedback about the appropriateness of such tests, specifically. I know it's fun to poke holes in all the flaws of a simplified example, but those are things I am well aware of and aren't helpful in giving me the insight I'm looking for. | |
| Jun 22, 2016 at 2:27 | comment | added | Robert Harvey | @Jonah: If you're going to insist on confining your unit test solely to the foreach construct, and not any conditions, side effects or behaviors outside of it, then you're right; the new unit test is really not all that interesting. | |
| Jun 22, 2016 at 2:06 | comment | added | Jonah | Yes, I agree that subtle error conditions should be tested, but imo that is not an interesting question -- the answer is clear. Hence the reason I specifically stated that, for purposes of my question, savePeople should not be responsible for error handling. To clarify again, assuming that savePeople is responsible only for iterating through the list and delegating the saving of each item to another method, should it still be tested? | |
| Jun 22, 2016 at 2:02 | history | answered | Telastyn | CC BY-SA 3.0 |