Run tests that reference a given selector

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Run tests that reference a given selector

Schwab,Wilhelm K
Hello all,

I am making some scary changes and want to focus my test running more
than is practical/easy/etc. with the usual tools, at least AFAIK.  I
could delete lots of stuff from an SUnitBrowser, but I'll close it
shortly after getting it right :(  My Acme browser goodie will open an
SUnitBrowser on (reasonably??) appropriate subsets of tests, but even
that is too course for what I doing right now.

Hence the code below.  Comments?

Have a good one,

Bill


-------------------


!TestCase class methodsFor!

prod:aSymbol
        "Run the test; do nothing if ok or go to a walkback."

        #wksSafe.
        ( self selector:aSymbol ) runCase.
! !
!TestCase class categoriesFor: #prod:!public! !

!TestCase class methodsFor!

runTestsReferencing:aSelector

                | testCase allTests |

        "
                TestCase runTestsReferencing:#something.

        "

        allTests := Array writeStream.
        self withAllSubclassesDo:[ :aClass |
                allTests nextPutAll:(
                        aClass allTestSelectors collect:[ :each |
                                aClass -> each
                ] ).
        ].

        allTests := allTests contents select:[ :assoc | | aClass selector method |
                aClass := assoc key.
                selector := assoc value.
                method := aClass compiledMethodAt:selector.
                method refersToLiteral:aSelector.
        ].

        allTests do:[ :assoc |
                assoc key prod:assoc value.
        ].
! !
!TestCase class categoriesFor: #runTestsReferecing:!public! !




--
Wilhelm K. Schwab, Ph.D.
[hidden email]