Unit testing
In unit testing, we test different units separately. By unit, we mean very small independent components. Obviously, components depend on each other but we consider a very small unit. In our case that small unit is class. The class is a unit that should have a single responsibility and it should be abstract from others and depend on the minimum number of other classes or components. Anyway, we can say in unit testing, we test class by creating an object of that class irrespective of whether it fulfills the required behavior.
One important thing to understand is that during unit tests, our test shouldn't touch code other than class/code under testing. If this code is interacting with some other object or external stuff during unit ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access