When developing the discuz logon script, a problem occurs: How to verify the real logon success of a virtual user? Of course, people familiar with the LoadRunner tool will know that checkpoints are used in the script, yes, that's right!
We know that there are two LR checkpoint functions: Text checkpoint web_find (), web_reg_find (), and image checkpoint web_image_check ()
Here we will only talk about how to use the image checkpoint web_image_check ().
First, let's take a look at the usage of this function: web_image_check () Syntax: int web_image_check (const char * checkname, <list of attributes>, <"alt = Alt" | "src = SRC">, last); parameter: 1. checkname: Check name. 2. List of attributes: supported attributes include: frame (when multiple frames exist, define the range of frames to be searched ). Supported options include: condition CT: the condition that passes the check. The default value is foundmatchcase: case-sensitive, and the default value is norepeat: whether to continue searching after the first matching string is found, default Value: yesreport: When (success, failure, and always) check results are displayed, alwaysonfailure by default: whether to continue when the value of failed CT is determined, the default value is continue on error. 3. alt: ALT mark of the image. 4. SRC: the SRC mark of the image.
In the LR tool, when inserting the web_image_check () function, there are two ways to check: one is to use the alt mark of the image, and the other is to use the SRC mark of the image.
On the login success page, right-click to view the source code and find the image to be checked. Here I use the SRC positioning path.
The Code is as follows:
1 web_url("forum.php_2", 2 "URL=http://192.168.157.128/Discuz/upload/forum.php", 3 "Resource=0", 4 "RecContentType=text/html", 5 "Referer=", 6 "Snapshot=t3.inf", 7 "Mode=HTML", 8 EXTRARES, 9 "URL=static/image/common/user_online.gif", ENDITEM,10 "URL=static/image/feed/favorite_b.png", ENDITEM,11 "URL=static/image/feed/magic_b.png", ENDITEM,12 "URL=static/image/feed/medal_b.png", ENDITEM,13 "URL=static/image/feed/task_b.png", ENDITEM,14 "URL=static/image/feed/wall_b.png", ENDITEM,15 "URL=static/image/common/style_switch.png", ENDITEM,16 "URL=static/image/feed/friend_b.png", ENDITEM,17 "URL=static/image/feed/thread_b.png", ENDITEM,18 LAST);19 20 web_image_check("web_image_check",21 "Src=/upload/uc_server/avatar.php?uid=2&size=small",22 LAST);
Here, you need to note that when using image check points, the code location must put this function behind the URL of the submitted access. If it is placed before it, an error is reported, and the following error message is returned.
Action_login.c(33): Continuing after Error -27191: "web_image_check" failed (0 occurrence(s) found. , Src="/upload/uc_server/avatar.php?uid=2&size=small") [MsgId: MERR-27191]
The error message above indicates that the checkpoint cannot be found and three possible reasons are summarized:
1. Check whether the parameter information is written incorrectly;
2. web_image_check (): Check the source code of the image to see if it is an image on this page. It is likely that the image is incorrectly selected, that is, the selected image does not belong to this page;
Extended knowledge:
The image check point function web_image_check () supports embedding Association variables, meaning that the association variables can be embedded in alt = "" Or src = "".
I have to manage the profile picture here, because the profile picture of each user is different and the userid is different. The Code is as follows:
1 web_reg_save_param("uidParam", 2 "LB=
After LR playback, you can see that the Association is successful,
LR practice-discuz Open Source Forum-Logon script checkpoint