Web test tool comparison - automation function test (3)

zhaozj2021-02-16  63

Scalability evaluation, you know that in the test software, the data is critical. For example, if you need to verify that all users can log in successfully. It is too large to use manual test work. Use the powerful feature of the test tool script to reduce workload. Log in to any user, the script reads data from the user file, each tester needs to test new users, as long as adding In the user list, you can automatically test whether the new user login is successful.

WinRunner

Design User.txt Text Format: User Password

As: admin jetspeed

The script is as follows:

Web_browser_invoke (IE, "http://192.168.1.42"); win_max ("browser main window"; // Open file

File_Open ("f: //user.txt", fo_mode_read);

// read file data, fill in the username, password while (file_getline ("f: //user.txt", line) == 0) {WIN_MOUSE_CLICK ("html_frame_2", 402, 36); win_type ("HTML_FRAME_2", Line); WIN_MOUSE_CLICK ("HTML_FRAME_2", 566, 33);} file_close ("f: //user.txt");

Remarks: Because the WinRunner script is language is language, pay attention to the C language characteristics, use escape characters "/", file_open ("f: //user.txt", file_Open ("f: //user.txt", file_Open, here F: /user.txt It is necessary to add a synergistic character.

2. Robot

Design User.txt text format: user password

As: admin jetspeed

The script is as follows:

Sub

Main

Dim Result As INTEGER

DIM TEMP As String

DIM Filenumber As Integer

DIM IPOS as INTEGER

DIM UserName As String

DIM PW As String

'INITIALLY Recorded: 2003-12-22

17:07:58

'Script name: Demo

StartBrowser "http://192.168.1.42", "windowtag =webbrowser"

Window setContext, "WindowTag = Webbrowser", ""

Browser NewPage, "HTMLTITE = DynaWeb EPS 2003 Enterprise Portal", ""

'

FILENUMBER = FreeFile

/ / Loop reading the data in the file, log in

// Open the file in the form of self-reading

Open "f: /user.txt" for Input as #filenumber

Do While Not Eof (1)

// Read data, process

Line INPUT #filenumber, Temp

IPOS = INSTR (1, Temp, ")

// Extract user name

UserName = Left (Temp, IPOS-1)

//retrieve password

PW = Right (Temp, LEN (TEMP) -6) // Find the user, password text box, fill in the username, password

Editbox Click, "Name = UserName", "Coords = 35, 12"

InputKeys UserName

Editbox Click, "Name = Password", "Coords = 15, 8"

InputKeys PW

/ / Submit the data and exit the current user

PushButton Click, "Name = Submit"

Browser NewPage, "HTMLTITE = DynaWeb EPS 2003 Enterprise Portal", ""

HTMLIMAGE CLICK, "INDEX = 7", "Coords = 11, 7"

Loop

Close #filenumber

// Close IE

Window Closewin, "", ""

End Sub

3. Quick Test

Design User.txt text format: user password

As: admin jetspeed

The script is as follows:

Dim iPosDim UserNameDim pwDim fsoDim tsDim Temp Set fso = CreateObject ( "Scripting.FileSystemObject") Set ts = fso.OpenTextFile ( "F: /user.txt", 1) Do While not ts.AtEndOfStream Temp = ts.ReadLine iPos = InStr (1, TEMP, ") Username = Left (Temp, IPOS-1) PW = Right (Temp, Len (Temp) -6)

Browser ("DynaWeb EPS"). Page ("UserName"). SET UserName Browser ("DynaWeb EPS"). WebEdit ("Password"). Set PW Browser ("DynaWeb EPS"). Page ("DynaWeb EPS"). WebButton ("V {_U"). Click Browser ("DynaWeb EPS"). Page ("DynaWeb EPS_2"). LINK ("恄 q | ~" ). Click Browser ("DynaWeb EPS"). Page ("DynaWeb EPS_3"). Sync loop ts.close

Note: Quick Test script

One. Chinese Note To quotation marking

two. VBScript scripting language is limited, it is just a subset of VB languages

three. The declaration does not need to add types, otherwise the script is compiled without passing, the error is difficult

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

New Post(0)