Re: [Boost-users] [Test] How to Access Private Data from a Test
Hi Steven, On Donnerstag, 25. Juni 2015 21:24:51 Steven Clark wrote:
This remark really puzzles me. Do you feel that white-box testing should never be done? Or should never be needed?
Both, in fact. See Gavin's mail for the rationale. He explained it better than I would have :-) In fact, I've got a long way with black-box testing only in the past five years, so I have strong evidence that white-box testing is unnecessary. But this is on a fresh, test-driven developed code base. Designed to be black-box testable.
On Jun 25, 2015, at 4:52 PM, Jürgen Hunold
wrote: In my opinion, a test should never access private data.
Note the "In my opinion" :-)
But there are times and legacy code where I had no other choice, too.
And then I wrote the disclaimer that sometimes you can't do everything with black-box testing. I tried hard to get a test harness up for some legacy code in the years before and got stuck in multiple nested class hell, some d- Pointer magick and class hierarchies hard to instantiate. That is the reason why I was able to actually grep for the friend declarations needed in those cases. Not nice in my opinion, but "an ugly test is better than no test" (see http://www.artima.com/weblogs/viewpost.jsp?thread=203994 for more on a pragmatic view on unit tests). Which leads to the question if the OP was able to solve the issue or stopped reading after the first paragraph. Yours, Jürgen -- * Dipl.-Math. Jürgen Hunold ! * voice: ++49 4257 300 ! Fährstraße 1 * fax : ++49 4257 300 ! 31609 Balge/Sebbenhausen * jhunold@gmx.eu ! Germany
participants (1)
-
Jürgen Hunold