SUnit testing questions - class side methods and methods defined in private protocols
Hi all, in SUnit do we typically test methods found on the class side that are in "instance creation" and "class initialization" protocols? Also, do we test methods found on the instance side but in the protocol of private? Many thanks, Sheridan
On 05 Mar 2015, at 22:20, sheridan@sheridan-mahoney.com wrote:
Hi all,
in SUnit do we typically test methods found on the class side that are in "instance creation" and "class initialization" protocols?
Thereâs a lot of personal preference involved there :) If your creation / init methods contain some non-trivial logic (e.g. more than setting values) then I suggest you write tests. Otherwise, using the objects in other tests automatically covers creation and initialization (at least for the trivial cases).
Also, do we test methods found on the instance side but in the protocol of private?
Yes, absolutely, if they are not simply âprivate getters / settersâ. Black box testing just doesnât cut it in my experience. Private methods can often contain important code that needs to be tested but simply is not inteded for the public to be used. Cheers, Max
Many thanks,
Sheridan
participants (2)
-
Max Leske -
sheridan@sheridan-mahoney.com