Timeline for Should I unit test "internal" classes?
Current License: CC BY-SA 4.0
12 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 13, 2021 at 13:08 | comment | added | Criticizing Israel not allowed | You should test all things that need testing. Whether they're internal is irrelevant. | |
Aug 11, 2021 at 18:39 | vote | accept | Olivier D | ||
Aug 11, 2021 at 18:39 | answer | added | Olivier D | timeline score: 3 | |
Jul 27, 2021 at 19:42 | answer | added | Mike Robinson | timeline score: -1 | |
Jul 27, 2021 at 18:57 | comment | added | Solomon Slow | Re, "Harder to know how a method in ['internal' classes] are tested" Sometimes, that just means that you did not design those classes with testing in mind. If you embrace test-driven development then you won't often run into that problem. | |
Jul 27, 2021 at 18:28 | comment | added | Olivier D | You are right sir! You made me realize that injected classes must be public, thus must be tested separately. I took my example from a python code, and I wrongly assumed that they were internal classes. | |
Jul 27, 2021 at 18:15 | history | edited | Olivier D | CC BY-SA 4.0 |
added 219 characters in body
|
Jul 27, 2021 at 18:14 | comment | added | Vincent Savard |
The crux of your question is whether your internal classes are or are not implementation details, which is ambiguous from your question. You claim they are, but in most contexts I can think of, I would believe that neither a Service nor a Database class is an implementation detail of a Controller class, merely that they are dependencies which I would assume are themselves tested in isolation. I think you should either revise your example or your usage of internal class in order to clarify this ambiguity.
|
|
Jul 27, 2021 at 18:03 | comment | added | Olivier D | It is a c#. java concept where the class is only visible inside the same assembly/package, thus not publicly accessible. | |
Jul 27, 2021 at 15:46 | comment | added | Vincent Savard |
Can you precisely define what an internal class is, according to you? You seem to define both Service and Database classes as internal, while some developers would simply call them a class.
|
|
Jul 27, 2021 at 13:38 | answer | added | Robert Harvey | timeline score: 4 | |
Jul 27, 2021 at 13:29 | history | asked | Olivier D | CC BY-SA 4.0 |