Hi,

Today I found a bug in SUnit.

Sometimes when you have an abstract test class and you override it the
tests will be inherit or not.

If a subclass has other tests, the tests will not be inherited. If the
subclass has no other tests, the tests will be inherited.

Here is a little script showing the problem:

TestCase subclass: #A
        slots: {  }
        classVariables: {  }
        category: 'TestProblem'.
        
#A asClass subclass: #B
        slots: {  }
        classVariables: {  }
        category: 'TestProblem'.
        
#B asClass subclass: #C
        slots: {  }
        classVariables: {  }
        category: 'TestProblem'.
        
#A asClass class compile: 'isAbstract
        ^ self = A'.
        
#A asClass compile: 'actualClass
        ^ self subclassResponsibility'.
        
#A asClass compile: 'testTest
        self actualClass new'.
        
#C asClass buildSuiteFromAllSelectors run.
 "1 run, 0 passes, 0 skipped, 0 expected failures, 0 failures, 1 errors,
0 unexpected passes"

#C asClass compile: 'testAnotherTest
        self assert: true'.
        
#C asClass buildSuiteFromAllSelectors run.
  "1 run, 1 passes, 0 skipped, 0 expected failures, 0 failures, 0
errors, 0 unexpected passes"


In the last line I would expect 2 run cases. 1 pass and 1 error.

I think this is important to correct because it weaken the strength of
the tests.

https://pharo.fogbugz.com/f/cases/20118/SUnit-does-not-manage-well-abstract-test-classes


-- 
Cyril Ferlicot
https://ferlicot.fr

http://www.synectique.eu
2 rue Jacques Prévert 01,
59650 Villeneuve d'ascq France

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to