SystemOrganization addCategory: #'OB-SUnitIntegration'! !OBCodeBrowser methodsFor: '*ob-sunitIntegration' stamp: 'lr 10/14/2008 10:36'! cmdSUnitIntegration ^ OBCmdRunTests! ! !OBMethodNode methodsFor: '*ob-sunitintegration' stamp: 'lr 12/24/2009 10:43'! hasTestSuite ^ super hasTestSuite and: [ self selector beginsWith: 'test' ]! ! !OBMethodNode methodsFor: '*ob-sunitintegration' stamp: 'lr 12/24/2009 10:46'! testSuite ^ self theClass selector: self selector! ! !OBClassAwareNode methodsFor: '*ob-sunitintegration' stamp: 'lr 1/7/2010 13:36'! hasTestSuite ^ (self theClass includesBehavior: TestCase) and: [ self theClass isAbstract not ]! ! !OBClassAwareNode methodsFor: '*ob-sunitintegration' stamp: 'lr 12/24/2009 10:50'! testSuite ^ self theClass suite! ! !OBNode methodsFor: '*ob-sunitintegration' stamp: 'lr 12/24/2009 10:40'! hasTestSuite ^ false! ! !OBNode methodsFor: '*ob-sunitintegration' stamp: 'lr 12/24/2009 10:49'! testSuite ^ TestSuite new! ! !OBClassCategoryNode methodsFor: '*ob-sunitintegration' stamp: 'AdrianKuhn 12/22/2009 16:39'! hasTestSuite ^ self classes anySatisfy: [ :node | node hasTestSuite ]! ! !OBClassCategoryNode methodsFor: '*ob-sunitintegration' stamp: 'lr 12/24/2009 10:51'! testSuite ^ self classes inject: TestSuite new into: [ :suite :each | each hasTestSuite ifTrue: [ suite addTest: each testSuite ]. suite ]! ! !TestCase class methodsFor: '*ob-sunitintegration' stamp: 'lr 1/3/2010 15:29'! browserIcon | classHistory | self isAbstract ifTrue: [ ^ super browserIcon ]. classHistory := TestResult historyFor: self. (classHistory at: #errors) isEmpty ifFalse: [ ^ #testRed ]. (classHistory at: #failures) isEmpty ifFalse: [ ^ #testOrange ]. (classHistory at: #passed) isEmpty ifFalse: [ ^ #testGreen ]. ^ #testGray! ! !TestCase class methodsFor: '*ob-sunitintegration' stamp: 'lr 3/11/2010 19:41'! browserIcon: aClassDescription selector: aSelector (aClassDescription isAbstract or: [ aClassDescription isMeta or: [ (aSelector beginsWith: 'test') not ] ]) ifTrue: [ ^ super browserIcon: aClassDescription selector: aSelector ]. (aClassDescription methodRaisedError: aSelector) ifTrue: [ ^ #testRed ]. (aClassDescription methodFailed: aSelector) ifTrue: [ ^ #testOrange ]. (aClassDescription methodPassed: aSelector) ifTrue: [ ^ #testGreen ]. ^ #testGray! ! !OBMorphicIcons methodsFor: '*ob-sunitintegration' stamp: 'lr 3/28/2009 19:01'! testGray ^ ((ColorForm extent: 12@12 depth: 8 fromArray: #( 471604252 471604252 471604252 471604252 471604252 471604252 471604252 471604252 471604252 471604245 67180800 52173852 471604228 302583304 119282716 471604225 436213762 370940956 471604237 319162885 270277660 471604247 117572884 253500444 471604227 101388571 203168796 471604252 471604252 471604252 471604252 471604252 471604252 471604252 471604252 471604252) offset: 0@0) colorsFromArray: #(#(0.761 0.761 0.761) #(0.62 0.62 0.62) #(0.788 0.788 0.788) #(0.949 0.949 0.949) #(0.776 0.776 0.776) #(0.764 0.764 0.764) #(0.733 0.733 0.733) #(0.741 0.741 0.741) #(0.745 0.745 0.745) #(0.871 0.871 0.871) #(0.714 0.714 0.714) #(0.542 0.542 0.542) #(0.934 0.934 0.934) #(0.608 0.608 0.608) #(0.855 0.855 0.855) #(0.694 0.694 0.694) #(0.53 0.53 0.53) #(0.522 0.522 0.522) #(0.772 0.772 0.772) #(0.836 0.836 0.836) #(0.717 0.717 0.717) #(0.953 0.953 0.953) #(0.553 0.553 0.553) #(0.753 0.753 0.753) #(0.729 0.729 0.729) #(0.612 0.612 0.612) #(0.867 0.867 0.867) #(0.69 0.69 0.69) #( ) ))! ! !OBMorphicIcons methodsFor: '*ob-sunitintegration' stamp: 'lr 3/28/2009 19:00'! testGreen ^ ((ColorForm extent: 12@12 depth: 8 fromArray: #( 589505315 589505315 589505315 589505315 589505315 589505315 589505315 589505315 589505315 589505302 1248283 337847075 589505280 185011458 488842019 589505281 270075936 404955939 589505298 237047580 170074915 589505303 520428049 505619235 589505284 571803907 102966051 589505315 589505315 589505315 589505315 589505315 589505315 589505315 589505315 589505315) offset: 0@0) colorsFromArray: #(#(0.624 0.863 0.612) #(0.372 0.761 0.353) #(0.585 0.8 0.573) #(0.588 0.721 0.569) #(0.922 0.961 0.918) #(0.639 0.831 0.631) #(0.914 0.937 0.91) #(0.761 0.887 0.757) #(0.538 0.8 0.534) #(0.329 0.6 0.298) #(0.333 0.616 0.306) #(0.608 0.84 0.592) #(0.372 0.753 0.349) #(0.733 0.875 0.729) #(0.71 0.863 0.706) #(0.522 0.792 0.514) #(0.753 0.883 0.753) #(0.565 0.761 0.549) #(0.369 0.741 0.345) #(0.372 0.764 0.353) #(0.922 0.965 0.918) #(0.337 0.631 0.31) #(0.926 0.973 0.922) #(0.616 0.827 0.6) #(0.345 0.651 0.314) #(0.585 0.823 0.585) #(0.608 0.815 0.6) #(0.62 0.84 0.604) #(0.616 0.815 0.604) #(0.608 0.807 0.596) #(0.592 0.729 0.573) #(0.585 0.796 0.569) #(0.643 0.831 0.635) #(0.545 0.8 0.542) #(0.608 0.796 0.592) #( ) ))! ! !OBMorphicIcons methodsFor: '*ob-sunitintegration' stamp: 'lr 3/28/2009 18:59'! testOrange ^ ((ColorForm extent: 12@12 depth: 8 fromArray: #( 589505315 589505315 589505315 589505315 589505315 589505315 589505315 589505315 589505315 589505292 1318158 52634403 589505280 353567759 186852131 589505308 35522317 572728099 589505298 136384537 539173667 589505311 151064856 102966051 589505302 454694661 170074915 589505315 589505315 589505315 589505315 589505315 589505315 589505315 589505315 589505315) offset: 0@0) colorsFromArray: #(#(1.0 0.784 0.553) #(1.0 0.8 0.577) #(1.0 0.883 0.737) #(1.0 0.949 0.898) #(1.0 0.871 0.714) #(0.883 0.667 0.498) #(0.891 0.667 0.498) #(1.0 0.753 0.458) #(1.0 0.848 0.674) #(1.0 0.741 0.482) #(0.969 0.926 0.898) #(0.984 0.741 0.498) #(1.0 0.957 0.91) #(1.0 0.8 0.581) #(1.0 0.764 0.522) #(1.0 0.753 0.494) #(1.0 0.737 0.431) #(1.0 0.776 0.53) #(1.0 0.612 0.216) #(1.0 0.883 0.741) #(1.0 0.631 0.243) #(1.0 0.776 0.549) #(0.996 0.949 0.898) #(0.879 0.494 0.164) #(1.0 0.71 0.435) #(1.0 0.772 0.534) #(0.918 0.526 0.164) #(0.969 0.725 0.498) #(1.0 0.635 0.239) #(1.0 0.628 0.228) #(1.0 0.796 0.526) #(1.0 0.757 0.51) #(0.894 0.506 0.164) #(1.0 0.757 0.466) #(0.937 0.538 0.164) #( ) ))! ! !OBMorphicIcons methodsFor: '*ob-sunitintegration' stamp: 'lr 3/28/2009 18:59'! testRed ^ ((ColorForm extent: 12@12 depth: 8 fromArray: #( 589505315 589505315 589505315 589505315 589505315 589505315 589505315 589505315 589505315 589505302 269830 287515427 589505280 151065628 488842019 589505282 437981986 220406563 589505288 236066819 186852131 589505290 555032591 86188835 589505311 202835737 270738211 589505315 589505315 589505315 589505315 589505315 589505315 589505315 589505315 589505315) offset: 0@0) colorsFromArray: #(#(1.0 0.51 0.498) #(0.984 0.737 0.725) #(0.98 0.177 0.164) #(0.953 0.534 0.526) #(0.988 0.177 0.164) #(0.815 0.498 0.522) #(0.965 0.502 0.498) #(0.761 0.164 0.185) #(0.949 0.173 0.164) #(0.992 0.506 0.502) #(0.949 0.502 0.498) #(0.78 0.164 0.185) #(0.902 0.498 0.502) #(0.827 0.164 0.177) #(0.973 0.674 0.663) #(0.894 0.47 0.474) #(0.953 0.898 0.906) #(0.988 0.898 0.898) #(0.961 0.466 0.439) #(0.961 0.455 0.431) #(0.98 0.71 0.694) #(0.961 0.577 0.565) #(1.0 0.902 0.898) #(0.804 0.164 0.181) #(0.957 0.423 0.404) #(0.804 0.498 0.522) #(0.984 0.737 0.721) #(0.973 0.526 0.494) #(0.941 0.49 0.49) #(0.922 0.498 0.502) #(0.969 0.177 0.164) #(0.984 0.898 0.898) #(0.953 0.534 0.522) #(0.934 0.486 0.486) #(0.961 0.581 0.569) #( )))! ! !OBMethodCategoryNode methodsFor: '*ob-sunitintegration' stamp: 'lr 12/24/2009 10:52'! hasTestSuite ^ super hasTestSuite and: [ self methods anySatisfy: [ :node | node hasTestSuite ] ]! ! !OBMethodCategoryNode methodsFor: '*ob-sunitintegration' stamp: 'lr 12/24/2009 10:50'! testSuite ^ self methods inject: TestSuite new into: [ :suite :each | each hasTestSuite ifTrue: [ suite addTest: each testSuite ]. suite ]! ! OBCommand subclass: #OBCmdRunTests instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'OB-SUnitIntegration'! !OBCmdRunTests methodsFor: 'execution' stamp: 'lr 1/17/2010 13:35'! execute | result message defect | result := OBWaitRequest block: [ target testSuite run ]. message := result runCount printString , ' run, ' , result passedCount printString , ' passed, ' , result failureCount printString , ' failures, ' , result errorCount printString , ' errors'. (result respondsTo: #dispatchResultsIntoHistory) ifTrue: [ result dispatchResultsIntoHistory ]. requestor announce: OBRefreshRequired. result hasPassed ifTrue: [ ^ self inform: message ]. result runCount = 1 ifTrue: [ ^ result defects anyOne debug ]. defect := OBChoiceRequest prompt: message labels: (result defects collect: [ :each | each class name , '>>' , each selector printString ]) values: result defects lines: (Array with: result errors size). defect isNil ifFalse: [ defect debug ]! ! !OBCmdRunTests methodsFor: 'testing' stamp: 'lr 1/7/2010 13:37'! isActive ^ (requestor isSelected: target) and: [ target hasTestSuite ]! ! !OBCmdRunTests methodsFor: 'accessing' stamp: 'dc 7/22/2007 20:45'! keystroke ^ $t! ! !OBCmdRunTests methodsFor: 'accessing' stamp: 'lr 1/7/2010 13:37'! label ^ 'run tests'! !