Boost logo

Boost Users :

Subject: Re: [Boost-users] [test] testing protected/private methods out of testsuits
From: trashing_at_[hidden]
Date: 2008-09-22 14:14:19


Am Mo September 22 2008 10:58:30 schrieb Patrick Loney:
> >> I tried to test protected/private class methods by declaring the
>
> test->>case-class as a friend of the class-to-test.
>
> > Why are you trying to do this? In test driven development you should
>
> be >testing the interfaces not the internals, from Wikipedia:
>
> Apologies, you 'should', of course, be doing whatever you think best,
> however is it not possible to test your private methods via the public
> interface?

You mean by deriving my class_to_test with derived_class and wraping the
protected class_to_test::method_to_test by a public method in derived_class?

That's possible, but I didn't like that. Because if I'm precise I only test
the public method of derived_class that way ;-) But if nothing works, I will
do that.

To return to your previous posting:
I try to do my best and test only public method. But sometimes it's very hard,
especially for complex protected methods. Either you use the way descripted
above or you move the method to a helper class. Both alternatives are not
elegant I think.

greetz
Manuel
>
> ***************************************************************************
>***
>
> "This message and any attachments are solely for the intended recipient and
> may contain confidential and privileged information. If you are not the
> intended recipient, any disclosure, copying, use, or distribution of the
> information included in this message and any attachments is prohibited. If
> you have received this communication in error, please notify us by reply
> e-mail and immediately and permanently delete this message and any
> attachments. Thank you."
>
> Interactive Transaction Solutions Ltd (2473364 England)
>
> Registered Office:
> Systems House,
> Station Approach
> Emsworth PO10 7PW
>
> **********************************************************************
>
> Ce message électronique contient des informations confidentielles à l'usage
> unique des destinataires indiqués, personnes physiques ou morales. Si vous
> n'êtes pas le destinataire voulu, toute divulgation, copie, ou diffusion ou
> toute autre utilisation de ces informations, est interdite. Si vous avez
> reçu ce message électronique par erreur, nous vous remercions d'en avertir
> son expéditeur immédiatement par email et de détruire ce message ainsi que
> les éléments attachés.
>
> Interactive transaction Solutions SAS- France (RCS Pontoise : 489 397 877)
>
> Siège social :
> Parc Saint Christophe,
> 10, Avenue de lÂ’Entreprise
> 95865 Cergy-Pontoise Cedex
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________


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