Tools__TestRunnerMini.st
changeset 18341 35e3b3db76c8
parent 18290 dc1dab7d4d08
child 18707 da244f6b929a
equal deleted inserted replaced
18340:ec9fc4f27d67 18341:35e3b3db76c8
     1 "{ Encoding: utf8 }"
       
     2 
       
     3 "
     1 "
     4  Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague
     2  Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague
     5  Copyright (c) 2009-2010 eXept Software AG
     3  Copyright (c) 2009-2010 eXept Software AG
     6 
     4 
     7  Permission is hereby granted, free of charge, to any person
     5  Permission is hereby granted, free of charge, to any person
   720 runAllWithCoverage
   718 runAllWithCoverage
   721     "return a collection of classes which are covered by the selected
   719     "return a collection of classes which are covered by the selected
   722      tests. Requires that the testcase returns a non-empty collection
   720      tests. Requires that the testcase returns a non-empty collection
   723      from the coveredClasses query"
   721      from the coveredClasses query"
   724 
   722 
   725     |testedClasses suite packages package instrumentPackage answer|
   723     |testedClasses suite instrumentPackage|
   726 
   724 
   727     suite := self suiteForRunAll.
   725     suite := self suiteForRunAll.
   728 
   726 
   729     instrumentPackage := false.
   727     instrumentPackage := false.
   730     testedClasses := self allCoveredClasses.
   728     testedClasses := self allCoveredClasses.
   731     testedClasses isEmpty ifTrue:[
   729     testedClasses isEmpty ifTrue:[
   732 "/        "/ may be in a package?
   730         self suiteForRunAll tests isEmpty ifTrue:[
   733 "/        packages := suite tests collect:[:eachTest | eachTest class package] as:Set.
   731             Dialog warn:(resources stringWithCRs:'The test suite is empty - nothing covered, I assume.').
   734 "/        packages remove:'stx:libbasic' ifAbsent:[].
   732             ^ self.
   735 "/        packages size == 1 ifTrue:[
   733         ].   
   736 "/            package := packages first.
       
   737 "/            answer := Dialog 
       
   738 "/                confirmWithCancel:(resources 
       
   739 "/                                    stringWithCRs:'The test cases do not define any covered class.\(missing #coveredClassNames or #coveredPackageNames method)\\Instrument package("%1") or run without coverage ?'
       
   740 "/                                    with:package)
       
   741 "/                labels:(resources array:#('No' 'Unstrument Packages' 'Yes')).
       
   742 "/            
       
   743 "/self halt.
       
   744 "/        ] ifFalse:[
       
   745 "/            (Dialog confirm:(resources stringWithCRs:'The test cases do not define any covered class.\(missing #coveredClassNames or #coveredPackageNames method)\\Run without coverage ?'))
       
   746 "/            ifFalse:[^ self].
       
   747 "/        ].
       
   748         (Dialog confirm:(resources stringWithCRs:'The test cases do not define any covered class.\(missing #coveredClassNames or #coveredPackageNames method on the TestCase''s class side)\\Run without coverage ?'))
   734         (Dialog confirm:(resources stringWithCRs:'The test cases do not define any covered class.\(missing #coveredClassNames or #coveredPackageNames method on the TestCase''s class side)\\Run without coverage ?'))
   749         ifFalse:[^ self].
   735         ifFalse:[^ self].
   750     ] ifFalse:[
   736     ] ifFalse:[
   751         self withWaitCursorDo:[
   737         self withWaitCursorDo:[
   752             infoHolder notNil ifTrue:[
   738             infoHolder notNil ifTrue:[
   767         run:suite 
   753         run:suite 
   768         debug:false 
   754         debug:false 
   769         coverageContext:(InstrumentationContext new coverageOnly:true)
   755         coverageContext:(InstrumentationContext new coverageOnly:true)
   770 
   756 
   771     "Modified: / 19-07-2017 / 12:47:18 / cg"
   757     "Modified: / 19-07-2017 / 12:47:18 / cg"
       
   758     "Modified (format): / 21-08-2018 / 17:38:50 / Claus Gittinger"
   772 !
   759 !
   773 
   760 
   774 runFailed
   761 runFailed
   775     self run: self suiteForRunFailed.
   762     self run: self suiteForRunFailed.
   776 
   763