loadrunner常用函数

lr_eval_string()

函数的主要作用:返回脚本中的一个参数当前的值

返回值类型:char


char *x = "abc";//定义字符常量lr_save_string(x,"param");//把字符常量保存在参数中
lr_output_message("The param's value is %s",lr_eval_string("{param}"));先从参数提取出字符值,然后打印输出

lr_log_message(lr_eval_string("{param}"));


web_reg_find()

    //文本查找函数,放在请求页面之前

    web_reg_find("Fail=NotFound",
        "Search=Body",
        "SaveCount=testCount",
        "Text=Welcome, <b>zc", //英文状态下,考虑空格和字体
        LAST);


                   //放在请求页面之后

    if(atoi(lr_eval_string("{testCount}"))>0)
    {lr_output_message("字符串出现的次数: %s",lr_eval_string("{testCount}"));
    }
    else
    {lr_output_message("没找到");
    }


web_reg_save_param()
 关联函数

    //放在请求之前

    web_reg_save_param("test",
        "LB=<title>",
        "RB=</title>",
        "NotFound=ERROR",
        "Search=All",
        LAST);

    //放在请求之后

    lr_output_message("提取到参数test的值: %s",lr_eval_string("{test}"));






posted @ 2016-06-21 15:57  午夜飘雪789  阅读(170)  评论(0)    收藏  举报