Designing for testability

Andreas Pakulat apaku at gmx.de
Mon Sep 15 21:06:40 UTC 2008


Hi,

while writing the tests for the new sessioncontroller I've reached a
dead end. Basically I currently can't test wether the session provides
the right data area for a plugin because there's no easy way to obtain
an IPlugin and have plugincontroller know about the plugininfo for that
plugin. The reason for this is that Core and the controller's are
coupled pretty tightly, which means I can't just replace the
plugincontroller with my own that just has 1 IPlugin subclass hardcoded.

Now the question is how to best achieve that decoupling in a way that
also usable for testing plugins. Basically I'd like to be able to
replace any or all of the controller's when creating a Core object.
Obviously those special classes need to be subclasses of the existing
controller's overriding the important bits of them.

One possibility I can think of currently is providing setters for the
controller's and having CorePrivate check if any of the controller's is
already set to a valid value before creating a new instance of it.

Does somebody have a better idea to this?

Andreas

-- 
While you recently had your problems on the run, they've regrouped and
are making another attack.




More information about the KDevelop-devel mailing list