On Thu, Apr 5, 2012 at 3:17 PM, Benjamin <
[email protected]> wrote:

> per instance ?
> I you wanna know when a test instance you run started, I think there are
> better solutions than announcement.
>

Hehe, actually, if you are the one firing the test, then you do need
nothing :).  Also the tests instances are discarded to have independent
state so what I said is nonsense :).


>
> For me the goal of announcement is to emit, and than everyone can catch
> this information.
>

Hmm, that's one specific use for them...  You can build for example a small
application using announcements to decouple the UI from the model, and
there you probably will not make the announcer accessible for everyone.

> On Thu, Apr 5, 2012 at 2:57 PM, Benjamin <
> [email protected]> wrote:
>
>> 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 ?
>>
>> And then you lack the possibility to subscribe to a specific one...
Maybe you can add a method in TestCase hiding the subscriptions to all the
subclasses.


>
>> 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