Since there is an announcer per test class, you need to write something like

MyClass>>#register
        MyTestClass announcer
                on: TestCaseStarted send: #foo to: self.

It means than here you force a link from MyClass to MyTestClass. 
And if you want to be aware of all test case started, you need something like

TestCase withAllSubclasses do: [:e | e announcer
                                                                        on: 
TestCaseStarted send: #foo to: self ].

Why not using only one Announcer (and TestAnnouncer already exists and is 
already integrated) for all test class ?


Ben
 

On Apr 5, 2012, at 3:50 PM, Alexandre Bergel wrote:

> I proposed this test announcement facilities some times ago to get notified 
> when tests are being executed and when they are done. 
> 
> You said: "It means that you have to know which class to register to instead 
> of which announcer."
> Which unit to register you mean? Yes, the one you are interested in. I do not 
> see why it break the pattern. Consider TestCaseTest>>testAnnouncement. What 
> is wrong with it?
> 
> Cheers,
> Alexandre
> 
> 
> On 5 Apr 2012, at 06:14, Benjamin wrote:
> 
>> Hello guys,
>> 
>> I was implementing in Nautilus a listener to TestCaseStarted, and then I 
>> figured out that each TestCase subclasses have its own Announcer.
>> 
>> It means that you have to know which class to register to instead of which 
>> announcer. In a way, it breaks the Observer pattern.
>> 
>> Is there any good reason I am missing ?
>> 
>> I think it has been done in a way you can spy a particular test class, but 
>> since you have this info in the announcement itself, you can always filter 
>> with this info.
>> Cause for me, replacing all those announcer by TestAnnouncer seems to be a 
>> better solution.
>> 
>> 
>> 
>> Thanks in advance, 
>> 
>> Ben
> 
> -- 
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
> 
> 
> 
> 
> 
> 


Reply via email to