Showing posts with label classmapping. Show all posts
Showing posts with label classmapping. Show all posts

Monday, March 24, 2008

Class Mapping in Winrunner

Class Mapping concept is explained in Custom Objects . Winrunner (WR) also provides class mapping. The Class Mapping enables you to map a custom class to a Standard class.

You can map the classes by two ways.


  • By using Winrunner editor. Use GUI Map editor from Tools Menu.

  • By setting dynamically through TSL (Test Script language) code. See following code snippet.


Code:


#-------------------------------------------------------------------------
# Method : WindowsCustomTextbox
# Author : T.Palani Selvam
# Purpose : It directs the execution according to actions in text box & mapping with given class.
# Parameters:
# sCtrlName - contains name of that control.
# sAction - contains type of the action should be happened.
# sData - contains data to be checked or played in controls.
# sCustomClass - contains class name to be mapped.
# Returns : Integer - returns int value (TRUE = 1 or non-Zero, FALSE = 0)
# Caller :
# Calls : - Nil -
#Logical expressions are assigned the value 1 if true, and 0 if false - From TSL Reference.
#-------------------------------------------------------------------------
public function WindowsCustomTextbox(in sCtrlName,in sAction,in sData, in sCustomClass) {
auto sResult;
auto sMappedClass;
auto sLocation;

get_class_map(sCustomClass , sMappedClass); #Get mapped Class name.
#Verify thr control name type.
sLocation = IdentifyType(sCtrlName);
if (sLocation != "") {
sCtrlName = "{class: edit,MSW_class: " & sCustomClass & ",location: " & sLocation & " }";
}

if (sMappedClass != "edit") {
set_class_map(sCustomClass , "edit"); #Mapping.
sResult = WindowsTextbox(sCtrlName,sAction,sData);
unset_class_map(sCustomClass); #released mapping.
}else {
sResult = WindowsTextbox(sCtrlName,sAction,sData);
}
return sResult;

} #end of function WindowsCustomTextbox

Sunday, March 23, 2008

Class Mapping in QuickTestPro

Class Mapping concept is explained in Custom Objects . QuickTest Professional (QTP) also provides class mapping. The Object Mapping enables you to map an object of an unidentified or custom class to a Standard Windows class.

You can do by Object Identification dialog box from tools menu. For more information, you can refer help for Mapping User-Defined Test Object Classes.

Saturday, March 22, 2008

Class Mapping in Silktest

Class Mapping is explained in Custom Objects . Silk test also provides class mapping. Class mapping only works for objects that are created with standard classes but are given non-standard names. You can achieve class mapping by two ways.

1. One is by using silktest editor. Go to Options->Class Map. Then set choose custom and standard classes.

2. Another option is by 4test coding. You can use Agent option OPT_CLASS_MAP. The class mapping table for custom objects, with each entry in the list in the form "custom_class = standard_class".

Friday, March 21, 2008

Class Mapping in VisualTest

Already Class Mapping is explained in Custom Objects . Visual test also provides class mapping. VisualTest coding is similar to Visual Basic. But both are not same and used for different purposes. Below code is to treat any given custom class as Button class.

Code snippet:



'--------------------------------------
' Method : WindowsCustomButtonClick
' Author : T.Palani Selvam
' Purpose : Clicks the given Button element.
' Parameters: sButton - String, Contains name of control
' sBtnValue - String, Contains value of control
' sCustomClass - String, contains custom class name.
' Returns : Integer
' Caller : WindowsHandleClick(sContext, sForm, sElement ,sElementValue , sElementType)
' Calls : - Nil -
'-------------------------------------------
Function WindowsCustomButtonClick(sButton As String, sBtnValue As String, sCustomClass As String) As Integer

WButtonSetClass(sCustomClass)
WindowsCustomButtonClick = WindowsButtonClick(sButton, sBtnValue)
wResetClasses()
End Function

'---------------------------------------
' Method : WindowsButtonClick
' Author : T.Palani Selvam
' Purpose : Clicks the given Button element.
' Parameters: sButton - String, Contains name of control
' sBtnValue - String, Contains value of control
' Returns : Integer.
' Caller : WindowsHandleClick(sContext, sForm, sElement ,sElementValue , sElementType)
' Calls : - Nil -
---------------------------------------
Function WindowsButtonClick(sButton As String, sBtnValue As String) As Integer

WindowsButtonClick = False

If (WButtonExists(sButton)) Then
WButtonClick(sButton)
LogWrite("Successfully clicked button " + sButton, 1)
WindowsButtonClick = True
Else
LogWrite("Failure to Click Button " + sButton,1)
End If

End Function