LoadRunner + Java Script Chapter III

Source: Internet
Author: User

The 1.Java vuser template script is as follows:

/* * LoadRunner Java script. (Build: _build_number_) * * Script Description: * */import java.util.hashmap;import com. Interface.filmnews;import com. Interface.plans;import com.vug.vug;import Lrapi.web;import lrapi.lr;public class Actions{public static String uid = "Ko"  ;p ublic static string md5key = "JJ";p ublic static string filmhost = "Http://115.28.1/cias_web/server";p ublic static string Planhost = "Http://115.28.1/order/server"; Hashmap<string, string> params; Vug Vug; Build Build urlfilmnews fn; Video interface Plans PN;    Order Interface public int init () throws Throwable {vug = new Vug (uid, md5key);    params = new hashmap<string, string> ();    fn = new Filmnews (UID);//pn = new plans (UID); return 0;} End of Initpublic int action () throws Throwable {params = Fn.cinemas ();//interface to be tested string url = Vug.geturl (Filmhost, p Arams); Lr.start_transaction ("test"); Lr.think_time (1); Web.reg_find ("text=errcode\": 0 ", New string[]{" Savecount=errcode ", web. Last}); Web.rEg_save_param ("All", new String []{"lb={\" cinemaid\ ":", "rb=,", "Search=body", "Ord=all", "Last"}) ; Web.url ("Test", "url=" + url,new string[] {"Targetframe=", "resource=0", "reccontenttype=text/html", "mode=htm L "," Last "});/*params = Pn.orderadd (" <test> "," <test1> "," <test2> "); URL = vug.geturl (host, params); w Eb.url ("Test", "url=" + url,new string[] {"Targetframe=", "resource=0", "reccontenttype=text/html", "mode=html "Last"}); */if (Lr.eval_int ("<errCode>") = = 1) {lr.end_transaction ("test"), LR. PASS);}    else {lr.error_message (lr.eval_string ("<all_1>")); Lr.end_transaction ("Test", LR. FAIL);} return 0;} End of Actionpublic int end () throws Throwable {return 0;} End of End}

2. The above script is tested in the controller, and the other LR11 supports up to 1000java vuser virtual users, license as follows:
Golba-100:aeamauik-yafekekjjkeea-bcjgi
Golba-1000:aeacfsji-yasekjjkeahjd-bclbr
Web-10000:aeabexfr-ytiekekjjmfkekekwbraunqju-kbygb

LoadRunner + Java Script Chapter III

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.