• 常用函数


    常用函数

    Java Vuser  协议脚本

    Web-HTML/HTTP协议脚本

    引用类
    或库文件

    import lrapi.lr;
    import lrapi.web;

    通过globals.h文件引用

    think_time

    lr.think_time(3);

    lr_think_time(3);

    transaction

    lr.start_transaction("事务");
    ......
    lr.end_transaction("事务", lr.AUTO);

    lr_start_transaction("事务");
    ......
    lr_end_transaction("事务", LR_AUTO);

    set_option

    web.set_option("MaxRedirectionDepth", "0",
    new String[]{"LAST"});

    web_set_option("MaxRedirectionDepth", "0",
    LAST );

    set_user

    web.set_user("cluster",
    //lr.decrypt("58cf7265b1677820107f74"),
            "cluster",
            "172.17.2.89:8081");

    web_set_user("cluster",
            //lr_decrypt("58cf7265b1677820107f74"),
            "cluster",
            "172.17.2.89:8081");

    add_header

    web.add_header("Authorization",
    lr.eval_string("<BasicAuth>"));

    web_add_header("Authorization",
    lr_eval_string("{BasicAuth}"));

    output
    message

    lr.save_string("test","tParam");
    lr.output_message("tParam的值为:"
          +lr.eval_string("<tParam>"));

    lr_save_string("test","tParam");
    lr_output_message("tParam的值为:%s",
          lr_eval_string("{tParam}"));

    web_url

    web.url("Show status",
        "URL=http://172.17.2.89:8081/kettle/status/",
        new String[]{
            "Resource=0",
            "RecContentType=text/html",
            "Referer=http://172.17.2.89:8081/",
            "Snapshot=t3.inf",
            "Mode=HTTP",
            "LAST"});

    web_url("Show status",
        "URL=http://172.17.2.89:8081/kettle/status/",
        "Resource=0",
        "RecContentType=text/html",
        "Referer=http://172.17.2.89:8081/",
        "Snapshot=t3.inf",
        "Mode=HTTP",
        LAST);

    web_
    submit_data

    web.submit_data("executeJob",
        "Action=http://172.17.2.89:8081/kettle/executeJob/",
        new String[]{
            "Method=POST",
            "RecContentType=text/html",
            "Referer=",
            "Mode=HTTP"},
        new String[]{// "ITEMDATA",  不要加这条
            "Name=job", "Value=/DZ/job/HYHZ", "ENDITEM",
            "Name=level", "Value=Debug", "ENDITEM",
            "Name=rep", "Value=DZHY0620", "ENDITEM",
            "LAST"});

    web_submit_data("executeJob",
        "Action=http://172.17.2.89:8081/kettle/executeJob/",
        "Method=POST",
        "RecContentType=text/html",
        "Referer=",
        "Mode=HTTP",
        ITEMDATA,
            "Name=job", "Value=/DZ/job/HYHZ", ENDITEM,
            "Name=level", "Value=Debug", ENDITEM,
            "Name=rep", "Value=DZHY0620", ENDITEM,
        LAST);

    web_
    custom_request

    String htmlBody="这里是body串";
    web.custom_request("ViewStreamLogin",
        "Method=POST",
        new String[]{
            "URL=http:/*.*.cn/login?user=test&passwd=123",
            htmlBody,
            "TargetFrame=",
            "Referer=",
            "Mode=HTTP",
            "LAST"});

    web_custom_request("ViewStreamLogin",
        "URL=http:/*.*.cn/login?user=test&passwd=123",
        "Method=POST",
        "TargetFrame=",
        "Resource=0",
        "Referer=",
        "Mode=HTTP",
        "Body=这里是body串",
        LAST);

    web_
    submit_form

    web.submit_form("authenticate",
        new String[]{
            "Snapshot=t2.inf"},
        new String[]{
            "Name=user", "Value=root", ENDITEM,
            "Name=passwd", "Value=2012", ENDITEM,
            "Name=key", "Value=<OFF>", ENDITEM,
            "LAST"});

    web_submit_form("authenticate",
        "Snapshot=t2.inf",
        ITEMDATA,
            "Name=user", "Value=root", ENDITEM,
            "Name=passwd", "Value=2012", ENDITEM,
            "Name=key", "Value={OFF}", ENDITEM,
        LAST);

  • 相关阅读:
    HDU Ignatius and the Princess III (母函数)
    HDU 1014 Uniform Generator
    HDU 1013 Digital Roots
    HDU u Calculate e
    HDU 1005 Number Sequence 找规律
    Vijos 送给圣诞夜的极光(bfs)
    HDU Sum Problem (一道神坑的水题)
    Vijos CoVH之再破难关(搜索+hash)
    VIjos 晴天小猪历险记之Number (搜索+链表hash)
    Vijos 有根树的同构问题【字符串---最小表示法】
  • 原文地址:https://www.cnblogs.com/wbw-test/p/11507156.html
Copyright © 2020-2023  润新知