TestCase.st
changeset 599 400bc2cb5690
parent 594 617433e967e9
child 600 71cb19568d8b
--- a/TestCase.st	Sat Jan 31 01:31:19 2015 +0100
+++ b/TestCase.st	Sun Feb 01 03:38:55 2015 +0100
@@ -1,5 +1,7 @@
 "{ Package: 'stx:goodies/sunit' }"
 
+"{ NameSpace: Smalltalk }"
+
 TestAsserter subclass:#TestCase
 	instanceVariableNames:'testSelector'
 	classVariableNames:''
@@ -354,7 +356,9 @@
 
 coveredClassNames
     "should be redefined to return a collection of classes which are tested by
-     this suite/case. These classes can be instrumented for coverage analysis,
+     this suite/case. If not redefined, coveredPackageNames should be.
+
+     These classes can be instrumented for coverage analysis,
      before running the suite"
 
     ^ #()
@@ -363,13 +367,29 @@
 !
 
 coveredClasses
-    "return a collection of classes which are tested by this suite/case.
+    "return a collection of classes which are tested by this suite/case,
+     from either the coveredPackageNames or coveredClassNames
+     (which ever returns non-nil.
+
      These classes can be instrumented for coverage analysis,
      before running the suite"
 
+    self coveredPackageNames notNil ifTrue:[
+        ^ self coveredPackageNames 
+                    collectAll:[:eachPackage | Smalltalk allClassesInPackage:eachPackage].
+    ].
     ^ self coveredClassNames collect:[:each | Smalltalk classNamed:each]
+!
 
-    "Created: / 04-07-2011 / 18:16:08 / cg"
+coveredPackageNames
+    "redefine this in a concrete testCase class to return non-nil,
+     to return a collection of packages which are tested by this suite/case.
+     If not redefined, coveredClassNames should be redefined.
+
+     These classes can be instrumented for coverage analysis,
+     before running the suite"
+
+    ^ nil
 ! !
 
 !TestCase class methodsFor:'quick testing'!
@@ -937,15 +957,15 @@
 !TestCase class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/goodies/sunit/TestCase.st,v 1.105 2014-11-18 18:22:22 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/goodies/sunit/TestCase.st,v 1.106 2015-02-01 02:38:55 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/goodies/sunit/TestCase.st,v 1.105 2014-11-18 18:22:22 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/goodies/sunit/TestCase.st,v 1.106 2015-02-01 02:38:55 cg Exp $'
 !
 
 version_SVN
-    ^ '$Id: TestCase.st,v 1.105 2014-11-18 18:22:22 cg Exp $'
+    ^ '$Id: TestCase.st,v 1.106 2015-02-01 02:38:55 cg Exp $'
 ! !