Class
AutomationDescriptor

This class represents the base class for all supported descriptors by this framework

Definition

Namespace:ArtOfTest.Common.Design.Extensibility.Descriptors

Assembly:ArtOfTest.WebAii.Design.dll

Syntax:

cs-api-definition
[DataContract(Namespace = "http://artoftest.com/schemas/WebAiiDesignCanvas/1.0.0")]
[KnownType(typeof(DescriptorConstraints))]
[KnownType(typeof(DataBoundObject))]
public abstract class AutomationDescriptor : DataBoundObject, INotifyPropertyChanged, ICustomTypeDescriptor, IExtensibleDataObject

Inheritance: objectDataBoundObjectAutomationDescriptor

Derived Classes: ActionDescriptorLogicalDescriptorVerificationDescriptor

Implements: ICustomTypeDescriptorIExtensibleDataObjectINotifyPropertyChanged

Inherited Members DataBoundObject._dataDataBoundObject.BindData<T>(string)DataBoundObject.BindDataCode(string)DataBoundObject.BindDataCode(string, PropertyInfo)DataBoundObject.Data

Constructors

AutomationDescriptor()

Empty Constructor for serialization

Declaration

cs-api-definition
public AutomationDescriptor()

AutomationDescriptor(ITargetElement)

Initialize a new descriptor using the primary key

Declaration

cs-api-definition
public AutomationDescriptor(ITargetElement target)

Parameters

target

ITargetElement

AutomationDescriptor(string, ITargetElement)

Initialize a new action object using the target

Declaration

cs-api-definition
public AutomationDescriptor(string name, ITargetElement target)

Parameters

name

string

target

ITargetElement

Fields

_dataBindingExpressions

The list of data binding expressions for this descriptors properties.

Declaration

cs-api-definition
[CLSCompliant(false)]
protected Dictionary<string, string> _dataBindingExpressions

Field Value

Dictionary<string, string>

_dynamicReadOnlyProperties

Dynamic read-only properties used to configure the display of properties in the properties window.

Declaration

cs-api-definition
[CLSCompliant(false)]
protected Dictionary<string, bool> _dynamicReadOnlyProperties

Field Value

Dictionary<string, bool>

_dynamicVisibilityProperties

Properties used to configure the display of the properties in the properties window.

Declaration

cs-api-definition
[CLSCompliant(false)]
protected Dictionary<string, bool> _dynamicVisibilityProperties

Field Value

Dictionary<string, bool>

_editorType

The editor UI associated with this descriptor

Declaration

cs-api-definition
[CLSCompliant(false)]
protected Type _editorType

Field Value

Type

_elementDescriptors

The list of descriptors of the elements contained in this.Targets. This is the only structure that will get serialized as part of the descriptor de-serialization.

Declaration

cs-api-definition
[CLSCompliant(false)]
protected Dictionary<string, ElementDescriptor> _elementDescriptors

Field Value

Dictionary<string, ElementDescriptor>

_hasQuickTask

Whether the descriptor support a quick task or not

Declaration

cs-api-definition
[CLSCompliant(false)]
protected bool _hasQuickTask

Field Value

bool

_pauseType

Whether to pause execution

Declaration

cs-api-definition
[CLSCompliant(false)]
protected StepPauseType _pauseType

Field Value

StepPauseType

_quickTasks

The quick task if supported.

Declaration

cs-api-definition
[CLSCompliant(false)]
protected IQuickTasks _quickTasks

Field Value

IQuickTasks

_searchByImageFirst

Wait for all elements to exist first

Declaration

cs-api-definition
[CLSCompliant(false)]
protected SearchElementOrderType _searchByImageFirst

Field Value

SearchElementOrderType

_targets

The target descriptor objects that this action is targeting.

Declaration

cs-api-definition
[CLSCompliant(false)]
protected Dictionary<string, ITargetElement> _targets

Field Value

Dictionary<string, ITargetElement>

_testMethod

Gets the codeDom test method

Declaration

cs-api-definition
[CLSCompliant(false)]
protected CodeMemberMethod _testMethod

Field Value

CodeMemberMethod

_type

The descriptor type

Declaration

cs-api-definition
[CLSCompliant(false)]
protected AutomationDescriptorType _type

Field Value

AutomationDescriptorType

_waitOnElementsExistFirst

Wait for all elements to exist first

Declaration

cs-api-definition
[CLSCompliant(false)]
protected bool _waitOnElementsExistFirst

Field Value

bool

_waitOnElementsExistTimeout

The default time out to wait for

Declaration

cs-api-definition
[CLSCompliant(false)]
protected int _waitOnElementsExistTimeout

Field Value

int

Properties

CodeGenMode

Mode for code generation

Declaration

cs-api-definition
[Browsable(false)]
protected CodeGenMode CodeGenMode { get; set; }

Property Value

CodeGenMode

Constraints

Declaration

cs-api-definition
[DataMember(Name = "Constraints")]
[Browsable(false)]
public DescriptorConstraints Constraints { get; }

Property Value

DescriptorConstraints

CustomOrFriendlyDescription

Declaration

cs-api-definition
[Browsable(false)]
public string CustomOrFriendlyDescription { get; }

Property Value

string

DataBindingExpressions

Gets or sets the data binding expressions for this descriptor.

Declaration

cs-api-definition
[Browsable(true)]
[PrimaryProperty]
[DataMember(Name = "DataBindingExpressions")]
public Dictionary<string, string> DataBindingExpressions { get; set; }

Property Value

Dictionary<string, string>

DescriptorType

Declaration

cs-api-definition
[Browsable(false)]
public string DescriptorType { get; }

Property Value

string

DontUseDomState

Flag to indicate whether descriptor uses a DOM state

Declaration

cs-api-definition
[Browsable(false)]
public virtual bool DontUseDomState { get; }

Property Value

bool

DynamicReadOnlyProperties

Gets the dynamic read only properties of this descriptor

Declaration

cs-api-definition
[Browsable(false)]
public Dictionary<string, bool> DynamicReadOnlyProperties { get; }

Property Value

Dictionary<string, bool>

DynamicVisibilityProperties

Gets the visible properties of this descriptor

Declaration

cs-api-definition
[Browsable(false)]
public Dictionary<string, bool> DynamicVisibilityProperties { get; }

Property Value

Dictionary<string, bool>

EditorType

Gets or sets the editor type associated with this descriptor

Declaration

cs-api-definition
[Browsable(false)]
public Type EditorType { get; set; }

Property Value

Type

EditorTypeString

Declaration

cs-api-definition
[Browsable(false)]
[DataMember(Name = "EditorType")]
public string EditorTypeString { get; set; }

Property Value

string

ElementDescriptors

Gets the list of element descriptors persisted against this descriptor.

Declaration

cs-api-definition
[Browsable(false)]
[DataMember(Name = "Elements")]
public Dictionary<string, ElementDescriptor> ElementDescriptors { get; set; }

Property Value

Dictionary<string, ElementDescriptor>

ExtensionData

Declaration

cs-api-definition
[Browsable(false)]
public virtual ExtensionDataObject ExtensionData { get; set; }

Property Value

ExtensionDataObject

Implements IExtensibleDataObject.ExtensionData

FriendlyDescription

Get a friendly description of this descriptor to show in the scenario explorer.

Declaration

cs-api-definition
[Browsable(false)]
public virtual string FriendlyDescription { get; }

Property Value

string

HasQuickTasks

Gets whether this descriptors supports a quick task or not.

Declaration

cs-api-definition
[Browsable(false)]
public bool HasQuickTasks { get; }

Property Value

bool

IsSearchByImageApllicable

True if the image search option for the element is applicable for the descriptor.

Declaration

cs-api-definition
[Browsable(false)]
public virtual bool IsSearchByImageApllicable { get; set; }

Property Value

bool

LogMessageOnFailure

Get or set the message on log on failure

Declaration

cs-api-definition
[DataMember(Name = "LogMessageOnFailure")]
public string LogMessageOnFailure { get; set; }

Property Value

string

Pause

Declaration

cs-api-definition
[DataMember(Name = "Pause")]
public StepPauseType Pause { get; set; }

Property Value

StepPauseType

PrimaryProperties

Declaration

cs-api-definition
[Browsable(false)]
public IEnumerable<PropertyInfo> PrimaryProperties { get; }

Property Value

IEnumerable<PropertyInfo>

PrimaryTarget

Declaration

cs-api-definition
public virtual ElementDescriptor PrimaryTarget { get; set; }

Property Value

ElementDescriptor

PrimaryTargetKey

Gets the primary target key

Declaration

cs-api-definition
[Browsable(false)]
public virtual string PrimaryTargetKey { get; }

Property Value

string

QuickTasks

Gets the quick task if one exists else null

Declaration

cs-api-definition
[Browsable(false)]
public IQuickTasks QuickTasks { get; }

Property Value

IQuickTasks

RequiredAssemblyReferences

Any addition assembly references to be added to the project on code gen.

Declaration

cs-api-definition
[Browsable(false)]
public virtual string[] RequiredAssemblyReferences { get; }

Property Value

string[]

RunsAgainst

Declaration

cs-api-definition
[DataMember(Name = "RunsAgainst", EmitDefaultValue = false)]
public BrowserConstraints RunsAgainst { get; set; }

Property Value

BrowserConstraints

RunsAgainstVersion

Declaration

cs-api-definition
[DataMember(Name = "RunsAgainstVersion", EmitDefaultValue = false)]
public string RunsAgainstVersion { get; set; }

Property Value

string

RunsAgainstVersionCompare

Declaration

cs-api-definition
[DataMember(Name = "RunsAgainstVersionCompare", EmitDefaultValue = false)]
public NumberCompareType RunsAgainstVersionCompare { get; set; }

Property Value

NumberCompareType

SearchByImageFirst

Declaration

cs-api-definition
[DataMember(Name = "SearchByImageFirst")]
[PrimaryProperty]
public virtual SearchElementOrderType SearchByImageFirst { get; set; }

Property Value

SearchElementOrderType

SecondaryTarget

Declaration

cs-api-definition
public virtual ElementDescriptor SecondaryTarget { get; set; }

Property Value

ElementDescriptor

SecondaryTargetKey

Gets the secondary target key

Declaration

cs-api-definition
[Browsable(false)]
public virtual string SecondaryTargetKey { get; }

Property Value

string

StepType

Gets the step type.

Declaration

cs-api-definition
[DataMember(Name = "StepType")]
public AutomationDescriptorType StepType { get; set; }

Property Value

AutomationDescriptorType

SupportsConvertToCode

Whether the descriptor supports convert to code or not.

Declaration

cs-api-definition
[Browsable(false)]
public virtual bool SupportsConvertToCode { get; }

Property Value

bool

TargetSearchAlgorithm

Declaration

cs-api-definition
[Browsable(false)]
public TargetSearchAlgorithm TargetSearchAlgorithm { get; }

Property Value

TargetSearchAlgorithm

Targets

Gets the list of target elements to use for automation within this descriptor.

Declaration

cs-api-definition
[Browsable(false)]
public Dictionary<string, ITargetElement> Targets { get; set; }

Property Value

Dictionary<string, ITargetElement>

TargetsCustomControlTypes

Gets the targets custom control types for code-gen

Declaration

cs-api-definition
[Browsable(false)]
public Dictionary<string, Type> TargetsCustomControlTypes { get; }

Property Value

Dictionary<string, Type>

TechnologyType

Gets the technology that this step runs against

Declaration

cs-api-definition
[Browsable(false)]
public virtual TechnologyType TechnologyType { get; set; }

Property Value

TechnologyType

TestMethod

Gets the codeDom test method for codegen of this descriptor.

Declaration

cs-api-definition
[Browsable(false)]
public CodeMemberMethod TestMethod { get; set; }

Property Value

CodeMemberMethod

UseStepWaitOnElementsTimout

Declaration

cs-api-definition
[DataMember(Name = "UseStepWaitOnElementsTimout", IsRequired = false)]
public virtual bool UseStepWaitOnElementsTimout { get; set; }

Property Value

bool

WaitOnElements

Declaration

cs-api-definition
[DataMember(Name = "WaitOnElements")]
public virtual bool WaitOnElements { get; set; }

Property Value

bool

WaitOnElementsTimeout

Declaration

cs-api-definition
[DataMember(Name = "WaitOnElementsTimeout")]
public virtual int WaitOnElementsTimeout { get; set; }

Property Value

int

Methods

AreSameIncludingElements(AutomationDescriptor, AutomationDescriptor)

Returns true/false whether two descriptors are the same and have identical targets This function assumes that both descriptors have the same set of key names

Declaration

cs-api-definition
public static bool AreSameIncludingElements(AutomationDescriptor desc1, AutomationDescriptor desc2)

Parameters

desc1

AutomationDescriptor

The first decriptor

desc2

AutomationDescriptor

The second descriptor

Returns

bool

True/False on whether the descriptors match.

BindData(string)

If the descriptor supports data driven tests, then it can use this expand method to expand bindable properties or data before execution.

Declaration

cs-api-definition
protected override object BindData(string propertyName)

Parameters

propertyName

string

The property to expand on this descriptor.

Returns

object

The expanded expression (if it contains and data binding expression), else the property value unexpanded

Overrides DataBoundObject.BindData(string)

BindDataCode(string, string, Type)

Declaration

cs-api-definition
protected override object BindDataCode(string descriptorPropertyName, string controlPropertyName, Type controlPropertyType)

Parameters

descriptorPropertyName

string

controlPropertyName

string

controlPropertyType

Type

Returns

object

Overrides DataBoundObject.BindDataCode(string, string, Type)

ChangeTarget(ElementDescriptor, string)

Change a descriptors element

Declaration

cs-api-definition
protected void ChangeTarget(ElementDescriptor descriptor, string targetName)

Parameters

descriptor

ElementDescriptor

targetName

string

Clone()

Clone this descriptor

Declaration

cs-api-definition
public AutomationDescriptor Clone()

Returns

AutomationDescriptor

The cloned descriptor

ConsolidateText(string, string)

Consolidate the text

Declaration

cs-api-definition
public static string ConsolidateText(string original, string added)

Parameters

original

string

added

string

Returns

string

ConsolidateText(string, string, TextTypingInfo)

Declaration

cs-api-definition
public static string ConsolidateText(string original, string added, TextTypingInfo info)

Parameters

original

string

added

string

info

TextTypingInfo

Returns

string

CreateControlFromElement<TControl>(Element, int)

Declaration

cs-api-definition
protected TControl CreateControlFromElement<TControl>(Element element, int depth = 5) where TControl : Control, new()

Parameters

element

Element

depth

int

Returns

TControl

CreateControlFromTarget<TControl>(string, int)

Declaration

cs-api-definition
protected TControl CreateControlFromTarget<TControl>(string targetName, int depth = 5) where TControl : Control, new()

Parameters

targetName

string

depth

int

Returns

TControl

CreateElementFindExpression(string)

Creates a CodeDOM expression for the element's terminal FindExpression

Declaration

cs-api-definition
protected virtual CodeExpression CreateElementFindExpression(string elementKey)

Parameters

elementKey

string

Key into this descriptors collection of element descriptors for the desired element

Returns

CodeExpression

A CodeDOM expression that constructs a new FindExpression specifying the desired element

CreateElementReference(string)

Declaration

cs-api-definition
protected virtual CodeExpression CreateElementReference(string elementKey)

Parameters

elementKey

string

Returns

CodeExpression

CreateElementReference(string, bool, int)

Declaration

cs-api-definition
protected virtual CodeExpression CreateElementReference(string elementKey, bool waitForExistsState, int waitForExistsTimeout)

Parameters

elementKey

string

waitForExistsState

bool

waitForExistsTimeout

int

Returns

CodeExpression

GenerateLambdaExpression(CodeVariableReferenceExpression, CodeExpression, bool)

Declaration

cs-api-definition
protected CodeSnippetExpression GenerateLambdaExpression(CodeVariableReferenceExpression lambdaVarRef, CodeExpression lambdaValueExpr, bool isPositiveExpression = true)

Parameters

lambdaVarRef

CodeVariableReferenceExpression

lambdaValueExpr

CodeExpression

isPositiveExpression

bool

Returns

CodeSnippetExpression

GenerateLambdaExpression(CodeVariableReferenceExpression[], CodeExpression, bool)

Declaration

cs-api-definition
protected CodeSnippetExpression GenerateLambdaExpression(CodeVariableReferenceExpression[] lambdaVarRefs, CodeExpression lambdaValueExpr, bool isPositiveExpression = true)

Parameters

lambdaVarRefs

CodeVariableReferenceExpression[]

lambdaValueExpr

CodeExpression

isPositiveExpression

bool

Returns

CodeSnippetExpression

GenerateLambdaVariableRef()

Declaration

cs-api-definition
protected CodeVariableReferenceExpression GenerateLambdaVariableRef()

Returns

CodeVariableReferenceExpression

GenerateLambdaVariableRef(int)

Declaration

cs-api-definition
protected CodeVariableReferenceExpression GenerateLambdaVariableRef(int index)

Parameters

index

int

Returns

CodeVariableReferenceExpression

GenerateTernaryExpression(CodeExpression, CodeExpression, CodeExpression)

Declaration

cs-api-definition
protected CodeSnippetExpression GenerateTernaryExpression(CodeExpression condition, CodeExpression trueExpr, CodeExpression falseExpr)

Parameters

condition

CodeExpression

trueExpr

CodeExpression

falseExpr

CodeExpression

Returns

CodeSnippetExpression

GetAttributes()

Declaration

cs-api-definition
public AttributeCollection GetAttributes()

Returns

AttributeCollection

Implements ICustomTypeDescriptor.GetAttributes()

GetClassName()

Declaration

cs-api-definition
public string GetClassName()

Returns

string

Implements ICustomTypeDescriptor.GetClassName()

GetComponentName()

Declaration

cs-api-definition
public string GetComponentName()

Returns

string

Implements ICustomTypeDescriptor.GetComponentName()

GetConverter()

Declaration

cs-api-definition
public TypeConverter GetConverter()

Returns

TypeConverter

Implements ICustomTypeDescriptor.GetConverter()

GetDefaultEvent()

Declaration

cs-api-definition
public EventDescriptor GetDefaultEvent()

Returns

EventDescriptor

Implements ICustomTypeDescriptor.GetDefaultEvent()

GetDefaultProperty()

Declaration

cs-api-definition
public PropertyDescriptor GetDefaultProperty()

Returns

PropertyDescriptor

Implements ICustomTypeDescriptor.GetDefaultProperty()

GetEditor(Type)

Declaration

cs-api-definition
public object GetEditor(Type editorBaseType)

Parameters

editorBaseType

Type

Returns

object

Implements ICustomTypeDescriptor.GetEditor(Type)

GetEvents()

Declaration

cs-api-definition
public EventDescriptorCollection GetEvents()

Returns

EventDescriptorCollection

Implements ICustomTypeDescriptor.GetEvents()

GetEvents(Attribute[])

Declaration

cs-api-definition
public EventDescriptorCollection GetEvents(Attribute[] attributes)

Parameters

attributes

Attribute[]

Returns

EventDescriptorCollection

Implements ICustomTypeDescriptor.GetEvents(Attribute[])

GetHashCode()

Declaration

cs-api-definition
public override int GetHashCode()

Returns

int

Overrides object.GetHashCode()

GetLambdaExpression(CodeGenerationLanguage, CodeExpression)

Declaration

cs-api-definition
protected virtual string GetLambdaExpression(CodeGenerationLanguage language, CodeExpression expression)

Parameters

language

CodeGenerationLanguage

expression

CodeExpression

Returns

string

GetLambdaExpression(CodeGenerationLanguage, CodeExpression, bool)

Declaration

cs-api-definition
protected virtual string GetLambdaExpression(CodeGenerationLanguage language, CodeExpression expression, bool isPositiveExpression)

Parameters

language

CodeGenerationLanguage

expression

CodeExpression

isPositiveExpression

bool

Returns

string

GetLambdaVariableReference()

Declaration

cs-api-definition
protected virtual CodeVariableReferenceExpression GetLambdaVariableReference()

Returns

CodeVariableReferenceExpression

GetNoParamLamdaExpression(CodeGenerationLanguage, CodeExpression)

Declaration

cs-api-definition
protected virtual string GetNoParamLamdaExpression(CodeGenerationLanguage language, CodeExpression expression)

Parameters

language

CodeGenerationLanguage

expression

CodeExpression

Returns

string

GetNumberedVariableName(string)

Gets a variable name of the form baseName_i that isn't used yet in this descriptor's TestMethod statements collection.

Declaration

cs-api-definition
protected virtual string GetNumberedVariableName(string baseName)

Parameters

baseName

string

Returns

string

GetParentsReference(ElementDescriptor)

Declaration

cs-api-definition
protected CodeExpression GetParentsReference(ElementDescriptor descriptor)

Parameters

descriptor

ElementDescriptor

Returns

CodeExpression

GetProjectLanguage()

Get the code generation language.

Declaration

cs-api-definition
public CodeGenerationLanguage GetProjectLanguage()

Returns

CodeGenerationLanguage

The language enum

GetProperties()

Declaration

cs-api-definition
public PropertyDescriptorCollection GetProperties()

Returns

PropertyDescriptorCollection

Implements ICustomTypeDescriptor.GetProperties()

GetProperties(Attribute[])

Declaration

cs-api-definition
public PropertyDescriptorCollection GetProperties(Attribute[] attributes)

Parameters

attributes

Attribute[]

Returns

PropertyDescriptorCollection

Implements ICustomTypeDescriptor.GetProperties(Attribute[])

GetPropertyOwner(PropertyDescriptor)

Declaration

cs-api-definition
public object GetPropertyOwner(PropertyDescriptor pd)

Parameters

pd

PropertyDescriptor

Returns

object

Implements ICustomTypeDescriptor.GetPropertyOwner(PropertyDescriptor)

GetValidVariableName(string)

Declaration

cs-api-definition
protected virtual string GetValidVariableName(string currentName)

Parameters

currentName

string

Returns

string

HasRequiredValue(string, object)

Declaration

cs-api-definition
public virtual bool HasRequiredValue(string propertyName, object propertyValue)

Parameters

propertyName

string

propertyValue

object

Returns

bool

InvokeMethod(CodeExpression, bool, string, CodeGenerationLanguage, params object[])

Invoke a method on a control

Declaration

cs-api-definition
protected virtual CodeExpression InvokeMethod(CodeExpression controlReference, bool invoke, string methodName, CodeGenerationLanguage language, params object[] parameters)

Parameters

controlReference

CodeExpression

invoke

bool

Flag whether to add statement to code generation collection or just return the generated code expression.

methodName

string

language

CodeGenerationLanguage

The language in which to generate the method call

parameters

object[]

Returns

CodeExpression

InvokeMethod(CodeExpression, bool, string, params object[])

Invoke a method on a control

Declaration

cs-api-definition
protected virtual CodeExpression InvokeMethod(CodeExpression controlReference, bool invoke, string methodName, params object[] parameters)

Parameters

controlReference

CodeExpression

invoke

bool

Flag whether to add statement to code generation collection or just return the generated code expression.

methodName

string

parameters

object[]

Returns

CodeExpression

InvokeMethod(string, Type, bool, string, CodeGenerationLanguage, params object[])

Generate code that invokes a method on a control

Declaration

cs-api-definition
protected virtual CodeExpression InvokeMethod(string elementKey, Type controlType, bool invokeMethod, string methodName, CodeGenerationLanguage language, params object[] parameters)

Parameters

elementKey

string

controlType

Type

invokeMethod

bool

methodName

string

language

CodeGenerationLanguage

The language in which to generate the method call

parameters

object[]

Returns

CodeExpression

InvokeMethod(string, Type, bool, string, params object[])

Generate code that invokes a method on a control. Generates code in the language of the current project.

Declaration

cs-api-definition
protected virtual CodeExpression InvokeMethod(string elementKey, Type controlType, bool invokeMethod, string methodName, params object[] parameters)

Parameters

elementKey

string

controlType

Type

invokeMethod

bool

methodName

string

parameters

object[]

Returns

CodeExpression

InvokeMethod(string, bool, string, CodeGenerationLanguage, params object[])

Generate code that invokes a method on an object, and optionally add the code to the steps for the current test

Declaration

cs-api-definition
protected virtual CodeExpression InvokeMethod(string objectName, bool invoke, string methodName, CodeGenerationLanguage language, params object[] parameters)

Parameters

objectName

string

The name of the object

invoke

bool

Whether to add the code to the current test's steps

methodName

string

The name of the method

language

CodeGenerationLanguage

The language in which to generate the method call

parameters

object[]

Parameters for the method call

Returns

CodeExpression

A CodeExpression representing the method call

InvokeMethod(string, bool, string, params object[])

Generate code that invokes a method on an object, and optionally add the code to the steps for the current test. Generates code in the language of the current project.

Declaration

cs-api-definition
protected virtual CodeExpression InvokeMethod(string objectName, bool invoke, string methodName, params object[] parameters)

Parameters

objectName

string

The name of the object

invoke

bool

Whether to add the code to the current test's steps

methodName

string

The name of the method

parameters

object[]

Parameters for the method call

Returns

CodeExpression

A CodeExpression representing the method call

InvokeMethod(string, string, CodeGenerationLanguage, params object[])

Generate code that invokes a method on an object, and add the code to the steps for the current test

Declaration

cs-api-definition
protected virtual CodeExpression InvokeMethod(string objectName, string methodName, CodeGenerationLanguage language, params object[] parameters)

Parameters

objectName

string

The name of the object

methodName

string

The name of the method

language

CodeGenerationLanguage

The language in which to generate the method call

parameters

object[]

Parameters for the method call

Returns

CodeExpression

A CodeExpression representing the method call

InvokeMethod(string, string, params object[])

Generate code that invokes a method on an object, and add the code to the steps for the current test. Generates code in the language of the current project.

Declaration

cs-api-definition
protected virtual CodeExpression InvokeMethod(string objectName, string methodName, params object[] parameters)

Parameters

objectName

string

The name of the object

methodName

string

The name of the method

parameters

object[]

Parameters for the method call

Returns

CodeExpression

A CodeExpression representing the method call

InvokeWaitForExistsMethod(CodeExpression)

Invoke a method on a control

Declaration

cs-api-definition
protected virtual CodeExpression InvokeWaitForExistsMethod(CodeExpression controlReference)

Parameters

controlReference

CodeExpression

Returns

CodeExpression

InvokeWaitMethod(string, Type, int, int, CodeExpression)

Declaration

cs-api-definition
protected virtual CodeExpression InvokeWaitMethod(string elementKey, Type controlType, int timeOut, int checkInterval, CodeExpression lambdaStatement)

Parameters

elementKey

string

controlType

Type

timeOut

int

checkInterval

int

lambdaStatement

CodeExpression

Returns

CodeExpression

InvokeWaitMethod(string, Type, int, int, CodeExpression, CodeGenerationLanguage)

Declaration

cs-api-definition
protected virtual CodeExpression InvokeWaitMethod(string elementKey, Type controlType, int timeOut, int checkInterval, CodeExpression lambdaStatement, CodeGenerationLanguage language)

Parameters

elementKey

string

controlType

Type

timeOut

int

checkInterval

int

lambdaStatement

CodeExpression

language

CodeGenerationLanguage

Returns

CodeExpression

InvokeWaitMethod(string, Type, int, int, string, CodeGenerationLanguage, params object[])

Declaration

cs-api-definition
protected virtual CodeExpression InvokeWaitMethod(string elementKey, Type controlType, int timeOut, int checkInterval, string methodName, CodeGenerationLanguage language, params object[] parameters)

Parameters

elementKey

string

controlType

Type

timeOut

int

checkInterval

int

methodName

string

language

CodeGenerationLanguage

parameters

object[]

Returns

CodeExpression

InvokeWaitMethod(string, Type, int, int, string, params object[])

Declaration

cs-api-definition
protected virtual CodeExpression InvokeWaitMethod(string elementKey, Type controlType, int timeOut, int checkInterval, string methodName, params object[] parameters)

Parameters

elementKey

string

controlType

Type

timeOut

int

checkInterval

int

methodName

string

parameters

object[]

Returns

CodeExpression

IsDataBound(string)

Gets whether a property of this descriptor is data bound or not.

Declaration

cs-api-definition
protected override bool IsDataBound(string propertyName)

Parameters

propertyName

string

The property to check.

Returns

bool

True/False whether the property is data bound.

Overrides DataBoundObject.IsDataBound(string)

NotifyElementNameChange(ElementDescriptor)

Useful for custom translator descriptors to update their their friendly descriptions accordingly.

Declaration

cs-api-definition
public virtual void NotifyElementNameChange(ElementDescriptor elementDescriptor)

Parameters

elementDescriptor

ElementDescriptor

The element descriptor associated with that change.

OnBeforeConfirmRecording(object)

This method is called before an automation descriptor is recorded into the Test Explorer and allows the descriptor to perform any processing it may need to before it is recorded.

Declaration

cs-api-definition
public virtual void OnBeforeConfirmRecording(object data)

Parameters

data

object

Unused. Will be null.

OnBeforeElementDescriptorAdded(string, ITargetElement, FindExpressionElement)

This method is called before an ElementDescriptor is added to the ElementDescriptors collection and allows a descriptor to edit the FindExpression generated for that element.

Declaration

cs-api-definition
public virtual void OnBeforeElementDescriptorAdded(string key, ITargetElement targetElement, FindExpressionElement generatedElement)

Parameters

key

string

The key used to add to the Targets collection.

targetElement

ITargetElement

The target element the expression was generated for.

generatedElement

FindExpressionElement

The generated FindExpression

OnPropertyChanged(string)

Invoke the property changed event.

Declaration

cs-api-definition
public virtual void OnPropertyChanged(string propertyName)

Parameters

propertyName

string

The property name

ParseParameters(object[], out bool, CodeGenerationLanguage)

Create parameter array from all passed in parameters

Declaration

cs-api-definition
protected CodeExpression[] ParseParameters(object[] parameters, out bool isDataBound, CodeGenerationLanguage language)

Parameters

parameters

object[]

isDataBound

bool

language

CodeGenerationLanguage

Returns

CodeExpression[]

SetProperty(CodeExpression, object)

Sets a property for a given control

Declaration

cs-api-definition
protected virtual void SetProperty(CodeExpression controlReference, object propertyName)

Parameters

controlReference

CodeExpression

propertyName

object

SetProperty(CodeExpression, object, CodeGenerationLanguage)

Sets a property for a given control

Declaration

cs-api-definition
protected virtual void SetProperty(CodeExpression controlReference, object propertyName, CodeGenerationLanguage language)

Parameters

controlReference

CodeExpression

propertyName

object

language

CodeGenerationLanguage

SetProperty(string, Type, object)

Generates code for a set property on a control

Declaration

cs-api-definition
protected virtual void SetProperty(string elementKey, Type controlType, object propertyName)

Parameters

elementKey

string

controlType

Type

propertyName

object

SetProperty(string, Type, object, CodeGenerationLanguage)

Generates code for a set property on a control

Declaration

cs-api-definition
protected virtual void SetProperty(string elementKey, Type controlType, object propertyName, CodeGenerationLanguage language)

Parameters

elementKey

string

controlType

Type

propertyName

object

language

CodeGenerationLanguage

SupportsElementType(Type)

Declaration

cs-api-definition
public virtual bool SupportsElementType(Type elementType)

Parameters

elementType

Type

Returns

bool

ToCode()

This method is called when the user requests code generation. The framework initializes the TestMethod property of this object with a new instance that this method simply needs to add its custom codegen to it.

Declaration

cs-api-definition
public virtual void ToCode()

ToString()

String representation of an AutomationDescriptors

Declaration

cs-api-definition
public override string ToString()

Returns

string

Overrides object.ToString()

UsesTarget(string)

Whether or not this descriptor will use a target when it executes.

Declaration

cs-api-definition
public virtual bool UsesTarget(string target)

Parameters

target

string

Returns

bool

Remarks

Most descriptors use all of their targets, but some descriptors only use certain targets in specific modes. This method lets us check whether a descriptor uses a target in the mode the descriptor is currently in.

Events

PropertyChanged

Occurs when a property of the descriptor changes

Declaration

cs-api-definition
public event PropertyChangedEventHandler PropertyChanged

Event Value

PropertyChangedEventHandler

Implements INotifyPropertyChanged.PropertyChanged

In this article
DefinitionConstructorsAutomationDescriptor()AutomationDescriptor(ITargetElement)AutomationDescriptor(string, ITargetElement)Fields_dataBindingExpressions_dynamicReadOnlyProperties_dynamicVisibilityProperties_editorType_elementDescriptors_hasQuickTask_pauseType_quickTasks_searchByImageFirst_targets_testMethod_type_waitOnElementsExistFirst_waitOnElementsExistTimeoutPropertiesCodeGenModeConstraintsCustomOrFriendlyDescriptionDataBindingExpressionsDescriptorTypeDontUseDomStateDynamicReadOnlyPropertiesDynamicVisibilityPropertiesEditorTypeEditorTypeStringElementDescriptorsExtensionDataFriendlyDescriptionHasQuickTasksIsSearchByImageApllicableLogMessageOnFailurePausePrimaryPropertiesPrimaryTargetPrimaryTargetKeyQuickTasksRequiredAssemblyReferencesRunsAgainstRunsAgainstVersionRunsAgainstVersionCompareSearchByImageFirstSecondaryTargetSecondaryTargetKeyStepTypeSupportsConvertToCodeTargetSearchAlgorithmTargetsTargetsCustomControlTypesTechnologyTypeTestMethodUseStepWaitOnElementsTimoutWaitOnElementsWaitOnElementsTimeoutMethodsAreSameIncludingElements(AutomationDescriptor, AutomationDescriptor)BindData(string)BindDataCode(string, string, Type)ChangeTarget(ElementDescriptor, string)Clone()ConsolidateText(string, string)ConsolidateText(string, string, TextTypingInfo)CreateControlFromElement<TControl>(Element, int)CreateControlFromTarget<TControl>(string, int)CreateElementFindExpression(string)CreateElementReference(string)CreateElementReference(string, bool, int)GenerateLambdaExpression(CodeVariableReferenceExpression, CodeExpression, bool)GenerateLambdaExpression(CodeVariableReferenceExpression[], CodeExpression, bool)GenerateLambdaVariableRef()GenerateLambdaVariableRef(int)GenerateTernaryExpression(CodeExpression, CodeExpression, CodeExpression)GetAttributes()GetClassName()GetComponentName()GetConverter()GetDefaultEvent()GetDefaultProperty()GetEditor(Type)GetEvents()GetEvents(Attribute[])GetHashCode()GetLambdaExpression(CodeGenerationLanguage, CodeExpression)GetLambdaExpression(CodeGenerationLanguage, CodeExpression, bool)GetLambdaVariableReference()GetNoParamLamdaExpression(CodeGenerationLanguage, CodeExpression)GetNumberedVariableName(string)GetParentsReference(ElementDescriptor)GetProjectLanguage()GetProperties()GetProperties(Attribute[])GetPropertyOwner(PropertyDescriptor)GetValidVariableName(string)HasRequiredValue(string, object)InvokeMethod(CodeExpression, bool, string, CodeGenerationLanguage, params object[])InvokeMethod(CodeExpression, bool, string, params object[])InvokeMethod(string, Type, bool, string, CodeGenerationLanguage, params object[])InvokeMethod(string, Type, bool, string, params object[])InvokeMethod(string, bool, string, CodeGenerationLanguage, params object[])InvokeMethod(string, bool, string, params object[])InvokeMethod(string, string, CodeGenerationLanguage, params object[])InvokeMethod(string, string, params object[])InvokeWaitForExistsMethod(CodeExpression)InvokeWaitMethod(string, Type, int, int, CodeExpression)InvokeWaitMethod(string, Type, int, int, CodeExpression, CodeGenerationLanguage)InvokeWaitMethod(string, Type, int, int, string, CodeGenerationLanguage, params object[])InvokeWaitMethod(string, Type, int, int, string, params object[])IsDataBound(string)NotifyElementNameChange(ElementDescriptor)OnBeforeConfirmRecording(object)OnBeforeElementDescriptorAdded(string, ITargetElement, FindExpressionElement)OnPropertyChanged(string)ParseParameters(object[], out bool, CodeGenerationLanguage)SetProperty(CodeExpression, object)SetProperty(CodeExpression, object, CodeGenerationLanguage)SetProperty(string, Type, object)SetProperty(string, Type, object, CodeGenerationLanguage)SupportsElementType(Type)ToCode()ToString()UsesTarget(string)EventsPropertyChanged
Not finding the help you need?
Contact Support