Timeline for Unit testing code which does not establish correlation between input and output
Current License: CC BY-SA 4.0
14 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| S Jun 7, 2023 at 23:40 | vote | accept | Roman | ||
| Jun 6, 2023 at 22:00 | vote | accept | Roman | ||
| S Jun 7, 2023 at 23:40 | |||||
| Jun 5, 2023 at 14:54 | comment | added | Greg Burghardt | Ignore the down-voters. This question should be perfectly on topic for this site. | |
| Jun 5, 2023 at 14:51 | answer | added | candied_orange | timeline score: 5 | |
| Jun 5, 2023 at 11:04 | comment | added | Laiv |
There's no correlation between input and outputs Can you give an example? network traffic, db connections or calls to hardware APIs don't happen by spontaneous generation. Can you give a real-world example of this kind of code/situation you think can't be tested? I get the feeling you are making a wrong assumption in your reasoning about testing, but I don't dare to say what's the misconception. IO-bound code is perfectly testable if it's designed to be testable. Design matters.
|
|
| Jun 5, 2023 at 10:38 | comment | added | Roman | @Laiv E.g. series of calls which do get/set operation on hardware registers. There's no correlation between input and outputs, since actual results depend on hardware state, underlaying api state, etc. So in that case one can only mock apis, and check if all of the calls are done with right args, and simulate outputs. Which results in extrimely tight bond between code and tests and kind of disables tdd, since the tests are not abstract to implementation. | |
| Jun 5, 2023 at 6:17 | comment | added | Laiv |
Those calls tend not to have that direct correlation Can you elaborate on this?
|
|
| Jun 5, 2023 at 1:27 | answer | added | Flater | timeline score: 3 | |
| Jun 4, 2023 at 22:50 | answer | added | Greg Burghardt | timeline score: 7 | |
| Jun 4, 2023 at 22:28 | review | Close votes | |||
| Jun 9, 2023 at 3:08 | |||||
| Jun 4, 2023 at 22:11 | comment | added | gnat | see also: Where is the line between unit testing application logic and distrusting language constructs? | |
| Jun 4, 2023 at 22:11 | comment | added | gnat | Does this answer your question? When is unit testing inappropriate or unnecessary? | |
| S Jun 4, 2023 at 22:06 | review | First questions | |||
| Jun 5, 2023 at 1:31 | |||||
| S Jun 4, 2023 at 22:06 | history | asked | Roman | CC BY-SA 4.0 |