Testing Private Fields and Methods in Unit Tests

Covering private code in unit tests can be problematic as they aren't directly executable from unit tests.  I've seen developers take one of two approaches.  One approach is to embed tests for private code in unit tests for protected or public methods.  Another is to escalate the declaration in the code being tested from private to protected, so that they can be more easily handled in unit tests.  Both approaches are problematic.
Testing private methods indirectly through p...
 •  0 comments  •  flag
Share on Twitter
Published on January 02, 2016 05:16
No comments have been added yet.