Web test tool comparison - automation function test (2)

zhaozj2021-02-16  48

Easy to summarize:

1. Simple operation, but each script requires secondary development

2. Script language is different:

WinRunner script supports C language

Robot script supports VB scripts (you can extend the scripting language to support other languages ​​such as Perl, Java) to make the testers have greatly selected

Quick Test script supports VBScript scripts

One. Learning scripts: Robot and Quick Test are VB languages, easy to master, WinRunner scripts are C language, which is difficult, and the short-term improvement is relatively high.

two. Debug script: Robot script supports STEP, Animate and other modulation methods, WinRunner and Quick Test support STEP and other debugging methods, compare each other, the robot debugging is powerful, and intuitive.

three. Test environment compatibility:

Change the test environment configuration, turn the IE, change the window size, turn off, and re-run the test script.

WinRunner script fails, and the other two tools test playback success, compare finding that the WinRunner script relies on the object location, and Robot and Quick Test are confirmed by objects. The two test tools in stability are more preferable.

Such as: WinRunner script function

WIN_MOUSE_CLICK ("HTML_FRAME_2", 566, 33) records the click position in coordinates, and the script will not be executed when the object location changes.

There are two ways to solve object identification for WinRunner:

1. Coordinate fixing: After starting IE, make the IE window maximize, window coordinates are fixed, and then modify the script as follows

Web_browser_invoke (IE, "http://192.168.1.42");

/ / Maximize the window, the coordinates are fixed, and the problem of the machine resolution is not considered WIN_MAX ("Browser Main Window");

win_mouse_click ( "html_frame_2", 402, 36); win_type ( "html_frame_2", "admin jetspeed"); win_mouse_click ( "html_frame_2", 566, 33); win_check_gui ( "html_frame_2", "list1.ckl", " GUI1 ", 1);

The recorded script is basically played back (there is no case where the resolution is considered, otherwise the difficulty of the script development is increased.) This method is not a fundamental solution.

2. Let WinRunner know the object

Workaround is to develop DLL to let WinRunner references, Windows provides MSHTML objects, borrowing him to implement WinRunner understanding objects. Here I use the Word's development environment to make this function dynamically add username password (which can be rewritten into a DLL to WinRunner reference).

Main code (VB version):

IE: IE Load the webpage, enumerate all element objects, find the elements you want to find, and assign the value. Here is to find the username and password text box, add the username password into it.

DIM HDOC As HTMLDocument

DIM Elecoll As IhtmlelementCollection

DIM selement as htmlelement

DIM I as integer

Set hdoc = webbrowser1.documentset electricoll = hdoc.all

For Each SELEMENT IN Elecoll

If successintextedit then

If successment.outerhtml = "" THEN

Selement.setttribute "Value", "Admin"

END IF

If success.outerhtml = " "

Selement.setttribute "Value", "Jetspeed"

END IF

END IF

NEXT

Similarly, you can implement any objects of WinRunner identification webpage. (Own development test tool)

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

New Post(0)