Getting access to the TestBrowserClass

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

Getting access to the TestBrowserClass

TimM-3
Guys -

What is the reccomended way to get access to the test browser class, I note
that some of the presenters do:

testBrowserClass
 ^Smalltalk at: #SUnitBrowser ifAbsent: []

However there is also that entry in the User Preferences called
SUnitBrowser? This looks like someone could put a different class in there
if they want.  How do do you (in code) access the entry in the User
Preferences?

And - if the latter option is better - should the presenters also use that
mechanism?

Tim


Reply | Threaded
Open this post in threaded view
|

Re: Getting access to the TestBrowserClass

Ian Bartholomew-20
Tim,

The entry in the UserPreferences is because the SUnitBrowser class
declared itself to be a Tool (see the SUnitBrowser class>>initialize
method).  The #publishedAspects of the class now appear as changeable
options in the UserPreferences.

The ability to change the class used for a specific task (e.g. which
formatter class to use) is a different thing, although it uses the same
mechanism.  For those the DevelopmentSystem defines #publishedAspects
for each tool type and allows you to change the default tool class.  To
access the choice programatically you ask the default SmalltalkSystem ,
as in ....

SmalltalkSystem current formatterClass

To get the same behaviour for the SUnitBrowser you would have to add
support for it as a #publishedAspect of the DevelopmentSystem (aka the
(Refactoring)SmalltalkSystem class) and then change all references to
SUnitBrowser to ask the DevelopmentSystem which class to use when
browsing unit tests.

So the short answer is no, you have to use the Class name.  FWIW, I
would guess the

Smalltalk at: #SUnitBrowser ifAbsent: []

test was needed because the SUnitBrowser wasn't originally supplied with
the Dolphin image but was a, possibly missing, add-on.

Ian