16. How to get a text from a list box,a cell from a table etc..
1)To obtain a text from List box just select the range of items inthe list box and use GetSelection method along with the object name. You also have GetContent method to get all the items from the list.
2) To obtain a text from cell, Record: Click inside the cell and use GetROProperty("text") then you can see the text value. Same is the case with Table also.
4) how to import data for data driven test?
DataTable.ImportSheet(FileName, SheetSource, SheetDest) FileName (String): The full path of the Excel table from which you want to import a sheet. SheetSource (Variant): The name or index of the sheet in the file that you want to import. Index values begin with 1. SheetDest (Variant): The name or index of the sheet in the Data Table that you want to replace with the SheetSource. Index values begin with 1. Example The following example uses the ImportSheet method to import the first sheet of the name.xls table to the name sheet in the test's run-time Data Table. DataTable.ImportSheet "C:\name.xls" ,1 ,"name"
DataTable.ImportSheet(FileName, SheetSource, SheetDest) FileName (String): The full path of the Excel table from which you want to import a sheet. SheetSource (Variant): The name or index of the sheet in the file that you want to import. Index values begin with 1. SheetDest (Variant): The name or index of the sheet in the Data Table that you want to replace with the SheetSource. Index values begin with 1. Example The following example uses the ImportSheet method to import the first sheet of the name.xls table to the name sheet in the test's run-time Data Table. DataTable.ImportSheet "C:\name.xls" ,1 ,"name"
17. Give an example of a regular expression,user-define?
Regular Expressions: These r enable QT to identify Objects and Text Strings with varying values.There r so many examples for Regular expressions . plz refer Visual Basic6.0 any reference book.For example, start.* matches start, started, starting, starter, etc. You can use a combination of brackets and an asterisk to limit the search to a combination of non-numeric characters. For example: [a-zA-Z]* User Defined Functions: You can write your user-defined function directly into your test or component if you want to limit its use only to the local action or component, or you can store the function in an associated library file to make it available to many actions and tests or components (recommended). Note that if the same function name exists locally within your action or component and within an associated library file, QuickTest uses the function defined in the action or component. Function MyFuncWithParam (obj, x) dim y y = obj.GetROProperty("value") Reporter.ReportEvent micDone, "previous value", y MyFuncWithParam=obj.Set (x) End Function Built_in Function:QuickTest provides a set of built-invariables that enable you to use current information about the test and the QuickTest computer running your test. These can include the test name, the test path, the operating system type and version, and the local host name.
1)To obtain a text from List box just select the range of items inthe list box and use GetSelection method along with the object name. You also have GetContent method to get all the items from the list.
2) To obtain a text from cell, Record: Click inside the cell and use GetROProperty("text") then you can see the text value. Same is the case with Table also.
4) how to import data for data driven test?
DataTable.ImportSheet(FileName, SheetSource, SheetDest) FileName (String): The full path of the Excel table from which you want to import a sheet. SheetSource (Variant): The name or index of the sheet in the file that you want to import. Index values begin with 1. SheetDest (Variant): The name or index of the sheet in the Data Table that you want to replace with the SheetSource. Index values begin with 1. Example The following example uses the ImportSheet method to import the first sheet of the name.xls table to the name sheet in the test's run-time Data Table. DataTable.ImportSheet "C:\name.xls" ,1 ,"name"
DataTable.ImportSheet(FileName, SheetSource, SheetDest) FileName (String): The full path of the Excel table from which you want to import a sheet. SheetSource (Variant): The name or index of the sheet in the file that you want to import. Index values begin with 1. SheetDest (Variant): The name or index of the sheet in the Data Table that you want to replace with the SheetSource. Index values begin with 1. Example The following example uses the ImportSheet method to import the first sheet of the name.xls table to the name sheet in the test's run-time Data Table. DataTable.ImportSheet "C:\name.xls" ,1 ,"name"
17. Give an example of a regular expression,user-define?
Regular Expressions: These r enable QT to identify Objects and Text Strings with varying values.There r so many examples for Regular expressions . plz refer Visual Basic6.0 any reference book.For example, start.* matches start, started, starting, starter, etc. You can use a combination of brackets and an asterisk to limit the search to a combination of non-numeric characters. For example: [a-zA-Z]* User Defined Functions: You can write your user-defined function directly into your test or component if you want to limit its use only to the local action or component, or you can store the function in an associated library file to make it available to many actions and tests or components (recommended). Note that if the same function name exists locally within your action or component and within an associated library file, QuickTest uses the function defined in the action or component. Function MyFuncWithParam (obj, x) dim y y = obj.GetROProperty("value") Reporter.ReportEvent micDone, "previous value", y MyFuncWithParam=obj.Set (x) End Function Built_in Function:QuickTest provides a set of built-invariables that enable you to use current information about the test and the QuickTest computer running your test. These can include the test name, the test path, the operating system type and version, and the local host name.
18. how to change a name of an object in a application ..?
As a tester u only check the functionalities of the ojects. Developes can do that one. okthe blow answer gives u a good idea.When recording an object QuickTest Professional uses one of the object's properties as the logical name for the object (the name displayed in the Expert View and in the KeywardView modes).You can change the property that is used to be a different one by specifying which property's value you want to use as the logical name for the object.For example in order to use the alt property as the logical name of an image, run regedit.exe and set the following information:[HKEY_LOCAL_MACHINE\SOFTWARE\Mercury Interactive\QuickTest Professional\MicTest\Test Objects\Image]"tag query
name"="alt"
19. how to invoke a databse application for database testing?
testconnection("Select * from emptable")
Function testconnection(query)
Set cnn = CreateObject("ADODB.Connection")Set rs = CreateObject("ADODB.Recordset")cnn.ConnectionString ="DRIVER={Oracle in OraHome92};SERVER=servername;UID=userid;PWD=pwd;DBQ=dbinstance"cnn.open
rs.open query,cnn rs.movefirst
for i = 0 to rs.fields.countmsgbox rs(i)next End Function
20. How many types of recording are there in QTP?
There are 3 types of Recording modes in QTP1. Stndard Recording or General Recording2. Analog Recording3. Low-level Recording
21.How can you show the data from a particular row and column?
NumColumns=datatable.GlobalSheet.GetParameterCountNumRows=datatable.GlobalSheet.getrowcountFor i = 1 to NumRowsDatatable.SetCurrentRow(i)For j = 1 to NumColumnstblCellText = Datatable(j,dtGlobalsheet)If tblCellText <> "" ThenMsgbox "The Text in Row: " & i & " and Column: " & j & " is: " & tblCellTextEnd IfNext Next
22) How i can get class name of test object by repository ?
Right-click an object with the property or value you want to find in the Keyword View or Active Screen and choose Object Properties (or View/Add Object in the Active Screen), and then click the Repository button, choose Tools > Object Repository, or click the Object Repository toolbar button
23.How to click on the link available in the web table?
As a tester u only check the functionalities of the ojects. Developes can do that one. okthe blow answer gives u a good idea.When recording an object QuickTest Professional uses one of the object's properties as the logical name for the object (the name displayed in the Expert View and in the KeywardView modes).You can change the property that is used to be a different one by specifying which property's value you want to use as the logical name for the object.For example in order to use the alt property as the logical name of an image, run regedit.exe and set the following information:[HKEY_LOCAL_MACHINE\SOFTWARE\Mercury Interactive\QuickTest Professional\MicTest\Test Objects\Image]"tag query
name"="alt"
19. how to invoke a databse application for database testing?
testconnection("Select * from emptable")
Function testconnection(query)
Set cnn = CreateObject("ADODB.Connection")Set rs = CreateObject("ADODB.Recordset")cnn.ConnectionString ="DRIVER={Oracle in OraHome92};SERVER=servername;UID=userid;PWD=pwd;DBQ=dbinstance"cnn.open
rs.open query,cnn rs.movefirst
for i = 0 to rs.fields.countmsgbox rs(i)next End Function
20. How many types of recording are there in QTP?
There are 3 types of Recording modes in QTP1. Stndard Recording or General Recording2. Analog Recording3. Low-level Recording
21.How can you show the data from a particular row and column?
NumColumns=datatable.GlobalSheet.GetParameterCountNumRows=datatable.GlobalSheet.getrowcountFor i = 1 to NumRowsDatatable.SetCurrentRow(i)For j = 1 to NumColumnstblCellText = Datatable(j,dtGlobalsheet)If tblCellText <> "" ThenMsgbox "The Text in Row: " & i & " and Column: " & j & " is: " & tblCellTextEnd IfNext Next
22) How i can get class name of test object by repository ?
Right-click an object with the property or value you want to find in the Keyword View or Active Screen and choose Object Properties (or View/Add Object in the Active Screen), and then click the Repository button, choose Tools > Object Repository, or click the Object Repository toolbar button
23.How to click on the link available in the web table?
Link is an item in web table and link is not static, i mean it can be any where, you can not guess?here , there are two actions, one is to capture the newly added item and than clicking on it.... U can use description method. For more about this method see QTP help. I had used the same for the same issue, but not as different Actions. U still can try this.
24. how can we test datareports through QTP?
we can test data reports by using descriptive programming.
25. how can i write a script to automate the page which contains random questions with corresponding answers as radio buttons ? eg:questions1............a b c dquestion 2a b c d..............
ACTUAL_ANS(0) = "2"ACTUAL_ANS(0) = "1"ACTUAL_ANS(0) = "3"ACTUAL_ANS(0) = "4"
RANDOM_ANS(I) = ANY RANDOM NO THROUGH RANDOMIZE FN RANGE BETWEEN 1 TO 4
Browser("QUIZ").Page("QUIZ_PAGE").WebRadioGroup("FIRSTQN").Select "#"&RANDOM_ANS(0)Browser("QUIZ").Page("QUIZ_PAGE").WebRadioGroup("SECONDQN").Select "#"&RANDOM_ANS(1)Browser("QUIZ").Page("QUIZ_PAGE").WebRadioGroup("THIRDQN").Select "#"&RANDOM_ANS(2)Browser("QUIZ").Page("QUIZ_PAGE").WebRadioGroup("FOURTHQN").Select "#"&RANDOM_ANS(3)
VALIDATE FOR ALL THE ANSWERS IN THAT ARRAY IN A LOOP
FOR LOOPIF RANDOM_ANS(I) = ACTUAL_ANS(I)GOOD_ANWSERED = GOOD_ANWSERED + 1END IFMSGBOX GOOD_ANWSERED ARE THE SCORE !!!NEXT
24. how can we test datareports through QTP?
we can test data reports by using descriptive programming.
25. how can i write a script to automate the page which contains random questions with corresponding answers as radio buttons ? eg:questions1............a b c dquestion 2a b c d..............
ACTUAL_ANS(0) = "2"ACTUAL_ANS(0) = "1"ACTUAL_ANS(0) = "3"ACTUAL_ANS(0) = "4"
RANDOM_ANS(I) = ANY RANDOM NO THROUGH RANDOMIZE FN RANGE BETWEEN 1 TO 4
Browser("QUIZ").Page("QUIZ_PAGE").WebRadioGroup("FIRSTQN").Select "#"&RANDOM_ANS(0)Browser("QUIZ").Page("QUIZ_PAGE").WebRadioGroup("SECONDQN").Select "#"&RANDOM_ANS(1)Browser("QUIZ").Page("QUIZ_PAGE").WebRadioGroup("THIRDQN").Select "#"&RANDOM_ANS(2)Browser("QUIZ").Page("QUIZ_PAGE").WebRadioGroup("FOURTHQN").Select "#"&RANDOM_ANS(3)
VALIDATE FOR ALL THE ANSWERS IN THAT ARRAY IN A LOOP
FOR LOOPIF RANDOM_ANS(I) = ACTUAL_ANS(I)GOOD_ANWSERED = GOOD_ANWSERED + 1END IFMSGBOX GOOD_ANWSERED ARE THE SCORE !!!NEXT
26. Explain the need to use analog recording in qtp?
This mode records exact mouse and Key Board operations you perform in relation to the screen /Application Window. This mode is useful for the operation which you can record at Object Level, such as drawing a picture, recording signature. The steps recorded using Analog Mode is saved in separated data file, Quick Tests add to your Test a Run Analog File statement that calls the recorded analog File. This file is stored with your action in which these Analog Steps are created. The Step recorded in Analog mode can not be edited within QT.
27. What are the loops used in Quick Test Professional?
As like as win runner q.t.p allows FOR LOOP, WHILE LOOP, DO LOOP,IF CONDION
28. how to execute qtp script from command prompt?
You need to create a vbs file... then create a batch file....that's it, i think this is possible by the using CScript.exe "filename" in the command prompt.
29. how do we record a pop up window in QTP?
we can record a pop up window through Recovery Management
30. I am using QTP testing tool,What is micclass? and how to refer the different DLL\'s?
Micclass is nothing but the Type of Object in the Application like Webedit,WebRadiogroup,Webcheckbox
To make use of Dlls..CreateObject can be used. like ;
set obj = CreateObject("mydll")
mydll.customfunctions
This mode records exact mouse and Key Board operations you perform in relation to the screen /Application Window. This mode is useful for the operation which you can record at Object Level, such as drawing a picture, recording signature. The steps recorded using Analog Mode is saved in separated data file, Quick Tests add to your Test a Run Analog File statement that calls the recorded analog File. This file is stored with your action in which these Analog Steps are created. The Step recorded in Analog mode can not be edited within QT.
27. What are the loops used in Quick Test Professional?
As like as win runner q.t.p allows FOR LOOP, WHILE LOOP, DO LOOP,IF CONDION
28. how to execute qtp script from command prompt?
You need to create a vbs file... then create a batch file....that's it, i think this is possible by the using CScript.exe "filename" in the command prompt.
29. how do we record a pop up window in QTP?
we can record a pop up window through Recovery Management
30. I am using QTP testing tool,What is micclass? and how to refer the different DLL\'s?
Micclass is nothing but the Type of Object in the Application like Webedit,WebRadiogroup,Webcheckbox
To make use of Dlls..CreateObject can be used. like ;
set obj = CreateObject("mydll")
mydll.customfunctions
No comments:
Post a Comment