Last active
April 22, 2020 12:57
-
-
Save mabdi/230988081cdac6882a87314519c62620 to your computer and use it in GitHub Desktop.
Pharo Script: get number of classes, test classes, ...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| search packages classes testPackages tests focousedTests testMethodFocoused stat testrun | | |
search := 'project' asLowercase. | |
"replace with loading code" | |
Metacello new | |
baseline: '***'; | |
repository: 'github://****'; | |
load. | |
"end of loading code" | |
packages := RPackage organizer packages select: [:p | p name asLowercase includesSubstring: search ]. | |
classes := packages flatCollect: [ :p | p definedClasses ]. | |
testPackages := packages | |
select: [ :p | p definedClasses anySatisfy: [ :c | c isTestCase ] ]. | |
tests := testPackages | |
flatCollect: | |
[ :p | p definedClasses select: [ :c | c allSuperclasses includes: TestCase ] ]. | |
testrun := TestAsserter classForTestResult new. | |
tests do: [:ts | ts run: testrun]. | |
focousedTests := tests select: [ :s | s smallAmpTargetClasses isNotNil ]. | |
testMethodFocoused := focousedTests flatCollect: #allTestSelectors. | |
stat := { #packages -> packages size. | |
#classes -> classes size. | |
#testPackages -> testPackages size. | |
#tests -> tests size. | |
#focousedTests -> focousedTests size. | |
#focousedTestsMethods -> testMethodFocoused size. | |
#testsFails -> testrun failureCount. | |
#testsErrors -> testrun errorCount. | |
#testsPasses -> testrun passedCount. | |
} asString. | |
(FileSystem disk workingDirectory / (search,'.stat')) writeStream | |
nextPutAll: stat; | |
close. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment