Subscribing to an event in your tested application
Apologies if this information is readily available. I've been looking around and can't seem to find the answer. I'm testing a .NET (4.0/c#) WinForms application that is raising an event. In the object browser I see the add_MyEvent method which I call at the beginning of my script test passing a method name as below:
myForm.add_MyEvent( OnMyEvent );
function OnMyEvent( sender, args )
Log.Message( "I got here!" );
Obviously this doesn't seem to be working so I'm wondering what is the proper way to subscribe to an event in my testable application (if at all possible).
In addition, is there a way I can add a formal event in TestComplete in the event items that would listen for the event being fired in the testable application so that I don't need to subscribe/unsubscribe in every test?
Re: Subscribing to an event in your tested application
You can use the Connected Applications feature for that. C# Connected Applications allow you to write C# code in your application which interacts with TestComplete. So, you can implement an event handler in your application and work with TestComplete from that event handler. Please see the "Creating Connected Applications in C#" help topic (http://support.smartbear.com/viewarticle/32323/) for more information.