Toad World® Forums

Too many public procedures and functions ?


#1

Apologies if this has been asked somewhere already but I’m struggling to understand something within the world of TDD.

If I have a package with a number of small procedures and functions then is the general consensus that all these program units should be declared as public. If that is the case then just about every function and procedure you ever write will need to be public so that it is callable from a test case within QCTO.

I know I can work around this dynamically but it leaves me thinking that this must be something that everyone that uses QCTO for unit-testing must encounter.

Has anyone else got these concerns ? Obviously we should only really make public those units that should be exposed.


#2

This is definitely a concern - and not just for anyone who is using Code Tester. It is an issue for anyone wishing to thoroughly test their package-based code.

In fact, it is so common a concern, that I wrote a document to offer some ideas of how you can use conditional compilation to address the concern.

Testing private subprograms of a package :

http://unittest.inside.quest.com/entry.jspa?externalID=2001&categoryID=138

I hope this helps…SF


#3

Thanks for the very prompt reply. I will take a look at your document and come back with any further questions/concerns.


#4

Conditional compilation seems like an ideal solution for this issue. There’s obviously a slight overhead in implementing this but it’s much better than just making everything public.