Use Excel to do DataPool implementation of an instance of the Rational Robot function test

zhaozj2021-02-16  49

Rational Robot is a relatively universal software test tool. She is mainly used for functional testing and performance testing by recording (automatic or manual) scripts.

When you modify the Robot Recorded GUI script, often use the DataPool concept, because the Rational's own DataPool tool can only support the 2000 row of datasheet records, and the editing is not very convenient. Comparable EXCEL is used as a data source to realize the function of automatic testing.

Prerequisites: Office already installed in the OS system.

[Source code]

'$ include "Sqautil.SBH" Sub Main Dim Resin As Object Dim Worksheet As Object Dim S_Name As String Dim S_Pass AS String Dim Count As Integer

'Initially Recorded: 2004-4-2: 16: 55' Script Name: AUT_1_Login Window SetContext, "Caption = Program Manager", "" StartBrowser "C: / Program Files / Internet Explorer / IEXPLORE.EXE", "WindowTag = WEBBrowser "'' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' ' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' 'INITIAZE Excel On Error Resume Next Set Excel = getObject (, "Excel.Application" IF (Excel Is Nothing) THEN SET Excel = CreateObject ("Excel.Application" IF (Excel Is Nothing) The Msgbox "COULDN't Find Excel!" EXIT SUB END IF END If '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '

Set book = excel.workbooks.open ("Your book1.xls") set worksheet = book.worksheets ("Your Excel Sheet's Name") for count = 1 to 2 s_name = worksheet.cells (1, count) .Value s_pass = worksheet.Cells (2, count) .Value 'print s_name, s_pass Window SetContext, "Caption = Web applications - Microsoft Internet Explorer", "" Browser setFrame, "Type = HTMLFrame; HTMLId = mainframe", "" Browser NewPage, "hTMLTitle = Title", "" EditBox Click, "Type = EditBox; Name = userAccount", "Coords = 26,10" InputKeys s_name & "{TAB}" & s_pass PushButton Click, "Type = PushButton; HTMLText = log" Window SetTestContext, "Caption = Web applications - Microsoft Internet Explorer", "" Browser setFrame, "Type = HTMLFrame; HTMLId = mainframe", "" Window SetTestContext, "Caption = Microsoft Internet Explorer", "" Result = LabelVP (CompareProperties, "Text = Enter an error, please re-enter!", "Vp = Object Properties;" VP = Object Properties; "" "" "" "" "" "" "" "" " '' '' '' Excel.quit Set Excel = Nothing Window Closewin, "" "" End Sub

Note: List of a short code, just playing the role of tiles, Rational Suit is very powerful, I hope to meet more friends, learn together, improve the quality of the entire industry.

My contact information: email: liqk@slof.com

QQ: 26205478

Welcome to enlighten me.

To repost, keep the integrity of this document. Thank you!

转载请注明原文地址:https://www.9cbs.com/read-26767.html

New Post(0)