Installation and Usage

To use ProdUI, simply download and extract the latest build to your computer. For any project that you wish to include the Prod functionality, add a reference to the ProdUI.dll file.

Prods are invoked in one of 2 ways:

  • Through a set of static methods
  • Through a set of instance methods managed by a ProdSession

Static Methods – Prods can be invoked upon a control by passing the handle to the container window and either the name of the control, or its AutomationId

/* Assuming "Calculator" is running, this will press the "7" button */ 
ProdWindow win = new ProdWindow("Calculator"); 
Prod.ButtonClick(Prod.GetControlHandle(win.Handle,"7")); 
IntPtr hand = Prod.GetControlHandle(win.Handle,"7"); 
Prod.ButtonClick(hand);
 

These methods are intended as “one-shot” ways of accessing a control. Inside of the general Prod static functions, there is a generic "Click" function, that can be called on a UI element to invoke its default operation.

Static Prods are loggable, and a static ProdSession needs to be created in order to send these through. If the static ProdSession and instanced ProdSessionManager( see section below) use the same configuration file, they will write to the same file, using the same settings.

Managed by a ProdSessionManager – This is the preferred method for working with anything but the simplest of projects. The syntax for creating and invoking Prods is similar to the instance method example above, however, within a session, logging of actions as well as verification that an action has been performed (such as a click) or a value has been set (a TextBox , for example) are provided. More information about running via a session, as well as descriptions of logging and verification can be found in the documentation.

 
/* Assuming "Calculator" is running, this will press the "7" button twice */ 
ProdWindow win = new ProdWindow("Calculator") 
ProdButton button = new ProdButton(win, "7"); 
button.Click(); 
button.Click();
Verification? When an action is performed by a Prod (selecting, clicking, toggle, etc.) an event listener is placed to verify that the Prod did indeed take place. If the event listener times-out, ProdUI will attempt to reach the control via native methods. If, in the end, the system cannot verify that the event occurred, an exception is raised and logged.

In addition, when the action involves setting a value (a CheckBox to “checked”, or adding text to a TextBox, for example), the Prod system verifies that the current value matches the one that was requested by the user. If this cannot be verified, an exception is thrown.

In most Prods, there are “fallback” methods of sending messages to the controls to see if they respond to that. If so, they are verified and things continue.

Full documentation of the API can be found in a .chm file included in the download package.

See also

Last edited Jun 22, 2011 at 8:30 PM by hroark, version 5

Comments

No comments yet.