Timeline for Is it OK to introduce methods that are used only during unit tests?
Current License: CC BY-SA 3.0
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jun 26, 2011 at 12:14 | vote | accept | Mchl | ||
| Jun 24, 2011 at 23:58 | comment | added | BillThor | If you add the methods they become part of the contract with your users. You will end up with coders who call your test-only functions and branch based on the results. Generally, I prefer to expose as little of the class as possible. | |
| Jun 24, 2011 at 20:12 | comment | added | Mchl | On the other hand and in the light of this question: programmers.stackexchange.com/questions/86656/… when we distinguish "TDD tests" from "unit tests" this becomes perfectly fine (still the database plumbing though :P ) | |
| Jun 24, 2011 at 20:05 | comment | added | Mchl | I see the pointh ere, although I'm a bit reluctant to add testing of StrategyClass algorithms when I want to test if factory method is doing it's job. This kind of breaks isolation IMHO. Another reason I want to avoid that is that these particular classes operate on database, so testing them requires additional mocking/stubbing. | |
| Jun 24, 2011 at 20:02 | comment | added | Steven A. Lowe | +1 OP is describing 'clear box' unit testing, not TDD feature testing | |
| Jun 24, 2011 at 19:51 | history | answered | Jeremy | CC BY-SA 3.0 |