Liskov principle and unittest

deadalnix deadalnix at gmail.com
Fri Sep 23 02:55:25 PDT 2011


I recently faced a problem in java. I have looooooooots of classes 
inheriting from the same superclass. Thoses classes has to conform to 
some behaviour expected when manipulation the superclass as Liskov 
substitution principle says.

This is definitvelly hard to achieve. Solution promoted on the web are 
frankly not satisfying. Most of them suggest to inherit jUnit tests too, 
bit this is unable to handle classes implementing multiple interfaces, 
and require to write a test class for each subclasses. So if somebody 
don't do thoses tests, the subclass isn't checked (which is predictible) 
but the superclass tests are not ran either, which make things even 
worse. This innability to check that easily makes a lazy dev even more 
dangerous, which isn't what we want.

Back to D, which has integrated unittest, I wonder how I could implement 
such a check. I think the D unittest system suffer the same flaw as 
jUint (previously exposed). What do you think ?

deadalnix


More information about the Digitalmars-d mailing list