[TYPO3-dev] Unit tests and method visibility
Oliver Klee
typo3-german-02 at oliverklee.de
Mon Jul 6 12:11:27 CEST 2009
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
More information about the TYPO3-dev
mailing list