|
Boost Users : |
Subject: Re: [Boost-users] [Test] How to Access Private Data from a Test
From: Jürgen Hunold (jhunold_at_[hidden])
Date: 2015-06-26 01:32:43
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 <jhunold_at_gmx.eu> 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_at_gmx.eu ! Germany
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net