Quantcast
Channel: User Filip Milovanović - Software Engineering Stack Exchange
Viewing all articles
Browse latest Browse all 173

Comment by Filip Milovanović on Code reusability/inheritance introduces pointless testing

$
0
0
Declare those internals as separate classes. You can then either inherit them or compose them into your object. Then write tests for those classes once (if you're using inheritance and the base class is not itself instantiable, derive a dummy subclass for the purposes of the test), and write separate tests for the classes that use them internally, without testing those internals again. In other words, in this other set of tests, only test the abstract/high-level behavior that you want to remain unchanged if you took out those internals and replaced them with some other implementation.

Viewing all articles
Browse latest Browse all 173

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>