« Return to Thread: Unit tests and method visibility

Re: Unit tests and method visibility

by Oliver Klee-3 :: Rate this Message:

Reply to Author | View in Thread

Hi,

Francois Suter schrieb:
> TYPO3 is a collaborative development by a lot of people (core team
> members + wider community). It may well happen that someone wants to
> optimise code written by someone else. In such a case I'm sure that
> person would be happy to find "low level" unit tests to check that even
> internal methods are not broken by changes.

This might be a sign that the class is too big and does too much. In
that case, splitting it into smaller classes with high cohesion (ie. the
class has only one purpose) with a well-defined public interface would
be good.

Example: Old-style kickstarter-generated classes are hell to test
because they do everything in one class and have only one necessarily
public method (main). Splitting these classes will greatly improve
maintainability and testability.

So "low-level tests" shouldn't mean "let's test private methods", but
"let's test the lower-level classes instead".


Oliver
_______________________________________________
TYPO3-dev mailing list
TYPO3-dev@...
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev

 « Return to Thread: Unit tests and method visibility