Qtp

  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Qtp as PDF for free.

More details

  • Words: 924
  • Pages: 4
1. To use an external spreadsheet to data-drive a test 1. Open the Excel file in Excel. 2. Verify that the first row of data contains the Column headers. 3. Rename the sheet(s) to match the names used in the test script (e.g., Global, Action1, etc.). 4. Open the test script. 5. Go to Test -> Settings. 6. Select the Resources tab. 7. In the Data table section, select the "Other location" radio button. 8. Click to close the warning dialog. 9. Enter the full path to the Excel file or browse to the file using the browse button (...). 10. Click <Apply>. 11. Click .

2. To compare two .xls files TrueOrFalse = "Same" DataTable.Import("C:\Temp\test.xls") FirstTableCount = DataTable.GetRowCount DataTable.Import("C:\Temp\test1.xls") SecondTableCount = DataTable.GetRowCount if (FirstTableCount <> SecondTableCount) then msgbox "Both files are not Equal" else For I = 1 To FirstTableCount DataTable.Import("C:\Temp\test.xls") Datatable.SetCurrentRow(I) value1 = DataTable.Value("FirstSheetColumn") DataTable.Import("C:\Temp\test1.xls") Datatable.SetCurrentRow(I) value2 = DataTable.Value("SecondSheetColumn") if(value1 <> value2) then TrueOrFalse = "Different" Exit For end if Next end if msgbox(TrueOrFalse)

3. To parameterize a password

Option 1: Use the Set method instead of SetSecure and parameterize that. This method will not encrypt the password.

Option 2: 1. Enter the "real" password in the data table. 2. Select the column that contains the password. 3. Right-click on the selected column and select Data -> Encrypt. If you use Option 2, you can use the SetSecure method to directly access the encrypted password in the data table.

4. To specify number of times iteration in a test will execute

a. Go to Test -> Settings. b. Select the Run tab. c. In the Test Setting window, you will see a section called Data Table iterations. This is where you can specify the number of iterations. Select the "Run one iteration only" option to run only with the first row of data. Select "Run on all rows" to iterate through all rows of data. Select "Run from row x to row y" to specify which rows of data in the data table to use. Note: If you want to run on only one row of data, but do not want to use the first row, select the "Run from row x to row y" option specifying the same row for x and y.

5. To delete a row from the data table

Selecting a cell or row in the Data Table and pressing Ctrl+X or the Delete key on the keyboard deletes the data from the selected cell or row, but does not delete the actual cell or row. Thus, if you delete data from a row in the Data Table using one of these shortcut keys, QuickTest will still run an iteration on that row. Workaround: To delete an entire cell or row from the Data Table, select it and choose Delete from the context menu, or press Ctrl+K on the keyboard. 6. If you import a Microsoft Excel table containing a combo box or list cells, conditional formatting, or other special cell formats, the formats are not imported and the cells are displayed in the Data Table with fixed values. 7. When you record a test and you try to play it back a popup window opens saying that “An Exception occurred in pdm.dll and Quick Test is going to close”. How we go around this issue? If version 6.0.0.8169 of Pdm.dll is found on the system, install a newer version from: http://support.microsoft.com/support/kb/articles/Q293/6/23.ASP. This will be recognized during installation and QuickTest Professional will instruct you to download the corrected DLL from the Microsoft site.

8. To verify if a checkbox within a Web table is selected Use the ChildItem and GetROProperty methods to retrieve the state of a checkbox The ChildItem method will return an object referencing the checkbox. Follow this with the GetROProperty method will return the property value specified of the object. Example: Set myObj = Browser("Table Example").Page("Table Example").WebTable("Bats").ChildItem(1, 1, "WebCheckBox", 0) msgbox myObj.GetROProperty ("checked") Where 0 is not checked and 1 is checked. 9. To rename the local data sheet name in the data table If you rename a particular action that gets reflected in the local data sheet whereas you cannot rename any actions in the global data sheet.

10. to access the second row in local sheet without accessing the first row The SetCurrentRow method sets the specified row as the current (active) row in the run-time data table. Sheet.SetCurrentRow(RowNumber) RowNumber - Indicates the number of the row to set as the active row. If you do not specify that the sheet is a local sheet, using GetSheet, the row will be activated in the Global sheet by default. Example: DataTable.GetSheet("Action1") ' This will activate the specified sheet. DataTable.SetCurrentRow(2) ' This will set the specified row in the activated sheet. ' If the GetSheet function is not used, it will set the Row in the Global Sheet. msgbox(DataTable.Value("Data1", "Action1")) ' This will read the cell value. DataTable.GetSheet("Action2").SetCurrentRow(3) DataTable.Value("A", "Action2") = "new value"

Whats new in QTP8.2?

Unicode is supported. Function to send Test result as mail.

Function SendMail(SendTo, Subject, Body, Attachment) Set ol=CreateObject("Outlook.Application") Set Mail=ol.CreateItem(0) Mail.to=SendTo Mail.Subject=Subject Mail.Body=Body If (Attachment <> "") Then Mail.Attachments.Add(Attachment) End If Mail.Send 'ol.Quit 'ol.Skip Set Mail = Nothing Set ol = Nothing End Function '********************************************************************** *************************** 'Function SendMail(SendFrom, SendTo, Subject, Body) ' Set objMail=CreateObject("CDONTS.Newmail") ' ObjMail.From = SendFrom ' ObjMail.To = SendTo 'ObjMail.Subject = Subject 'ObjMail.Body = Body 'ObjMail.Send 'Set objMail = Nothing 'End Function '********************************************************************** ***************************** SendTo = "Some one" Subject = "Sending through QTP Test" Body = "Testing" Attachment = "Path" Call SendMail(SendTo, Subject, Body, Attachment)

Related Documents

Qtp
November 2019 27
Qtp
November 2019 22
Qtp
November 2019 17
Qtp
November 2019 26
Qtp
November 2019 20
Qtp
November 2019 15