|
Boost Users : |
Subject: Re: [Boost-users] whitebox testing with boost unit test framework?
From: Richard (legalize+jeeves_at_[hidden])
Date: 2011-12-21 18:57:26
[Please do not mail me a copy of your followup]
boost-users_at_[hidden] spake the secret code
<87pqfhijjd.fsf_at_[hidden]> thusly:
>Chris Cleeland <chris.cleeland_at_[hidden]> writes:
>
>> I'm using the boost unit test framework to implement unit tests for
>> code. I'm wondering if there is a best-practice for doing white-box
>> testing/internal state inspection of types under test. My hack right
>> now is to strip out "protected" and "private" from the header, but I
>> hold my nose as I do that.
>
>I don't use private members in the header file and put a subclass in the
>test implementation that makes the parent class' protected API public.
> [...]
I do this with legacy code, i.e. code that wasn't designed with
testing in mind.
However, I find that I don't need to do this when I practice TDD
because the classes were designed to be testable in the first place.
-- "The Direct3D Graphics Pipeline" -- DirectX 9 version available for download <http://legalizeadulthood.wordpress.com/the-direct3d-graphics-pipeline/> Legalize Adulthood! <http://legalizeadulthood.wordpress.com>
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