[Tutor] Unit testing: Just the API or internal use only methods, too?

Alan Gauld alan.gauld at yahoo.co.uk
Tue Jul 16 18:52:58 EDT 2019


On 16/07/2019 23:41, boB Stepp wrote:

> essentially said that I should be testing the public interface to my
> classes, but not the methods only used internally by the class and not
> meant to be publicly accessible.  

I suspect he meant that you should publish the tests for the API
but not necessarily for the internal/private methods.

You should definitely test all code you write, but how formally
you test the private stuff is up to you. But publishing the
public API tests allows clients to run them too.


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list