Extensibility: handling events

0 views
Skip to first unread message

Dave F

unread,
Aug 3, 2010, 1:07:52 PM8/3/10
to StorEvil
Hi guys.

I'm working on allowing you to hook into events by implementing an
interface in your context assembly, something like:

interface IHandle<TEvent> { void Handle<TEvent> }

so you could do:

public class TeamCityIntegrator : IHandle<ScenarioFinished> {
public void Handle(ScenarioFinished e) {
... output the custom TeamCity message here ...
}
}

Then this handler will be invoked with a ScenarioFinished message
after each scenario finishes and ScenarioFinished will expose a
property that tells you if it passed, failed, or is pending.

You can also implement IHandle<T> multiple times on the same object if
you want to listen to different events.

I'm thinking this will allow you to do, for example, TeamCity
integration by outputting the special TeamCity-formatted messages that
track tests and statistics.

Any thoughts or suggestions?

Glenn Block

unread,
Aug 3, 2010, 2:29:24 PM8/3/10
to stor...@googlegroups.com
Suggest you use MEF :-)
 
With [InheritedExport] you can drop it on your interface......
 
Glenn

Glenn Block

unread,
Aug 3, 2010, 2:31:13 PM8/3/10
to stor...@googlegroups.com
Looks clean to me. What type of information is provided in the args class?

On Tue, Aug 3, 2010 at 10:07 AM, Dave F <david...@gmail.com> wrote:

David Foley

unread,
Aug 3, 2010, 3:34:25 PM8/3/10
to stor...@googlegroups.com
You can see what I have so far (subject to change) here:

Dave F

unread,
Aug 22, 2010, 4:30:49 PM8/22/10
to StorEvil
OK, so this has been implemented and I think that I made the events
too large-grained.

For example: The LineExecuted event:

[Serializable]
public class LineExecuted
{
public string Line;
public ExecutionStatus Status;

public string SuccessPart = "";
public string FailedPart = "";
public string ExceptionInfo = "";
public string Suggestion = "";
public Scenario Scenario;
}

Most of the fields are set only in certain cases, depending on
ExecutionStatus (Passed, Failed, Pending).

I am thinking that I will break this out into separate events for
LinePassed, LineFailed, and LinePending.

The trade-off is that we will end up with a lot more event types.

Anyone have any thoughts on this?

Cheers
Dave



On Aug 3, 12:34 pm, David Foley <davidmfo...@gmail.com> wrote:
> You can see what I have so far (subject to change) here:
>
> http://github.com/davidmfoley/storevil/tree/event-bus/Core/StorEvil/E...
>
> On Aug 3, 2010, at 11:31 AM, Glenn Block wrote:
>
>
>
> > Looks clean to me. What type of information is provided in the args class?
>
Reply all
Reply to author
Forward
0 new messages