如何在loadrunner中将一个脚本变量值传递给另一个脚本 [英] how to pass one script variable values to another script in loadrunner

查看:441
本文介绍了如何在loadrunner中将一个脚本变量值传递给另一个脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来加载Runner的人,并且我正在为REST准备脚本,在这里我将得到一个令牌作为响应,其中我需要在另一个脚本中使用相同的令牌值来验证客户详细信息,我正在使用web_reg_save_param t保存这些值即令牌值在某些变量中.请帮助我如何将特定值传递到另一个依赖的脚本中.

我已经尝试过以下脚本

if (atoi(lr_eval_string("{SecurityToken}")) > 0)
    {
        lr_end_transaction("01_Cards",LR_PASS);
        lr_output_message(lr_eval_string("Value of Security Token is : {SecurityToken}"));
    }
    else
    {
        lr_end_transaction("01_Cards",LR_FAIL);
        lr_output_message(lr_eval_string("Value of Security Token is : {SecurityToken}"));
    }

解决方案

您的管理层需要培训和辅导员.您可能会发现此声明令人发指,但正是您的管理层使您为问题所困扰.这是由在该领域具有二十年经验的人员提供的,该人员每年在涉及和不涉及LoadRunner的情况下,都在性能测试方面在线回答了上千个问题.您还可以在 http://www.perfbytes.com 上找到与该学科直接相关的播客. >

Virtual Table Server是在LoadRunner中执行此操作的机制.如果您不想使用VTS,则可以使用其他服务代理来处理此问题.已经围绕MYSQL,RabbitMQ,ORACLE和SQL Server队列表等构建了解决方案.此解决方案的体系结构是虚拟用户A写入队列.您尝试将数据传递到的虚拟用户B,从队列中弹出"下一个值.队列的面向服务的体系结构可以对锁进行适当的管理,以便将其推入队列并从队列中弹出以供多个用户使用.

您无法成功执行的操作是写入另一个用户的公用文件或参数文件.由于与锁定多个用户访问权限以进行读/写和锁定以及虚拟用户何时以及如何加载和寻址参数文件有关的六个不同原因,这将无法工作.

I am new to load runner and i am preparing script for REST ,here i will get one token in response where i need to use same token value in another script to validate the customer details ,i am using web_reg_save_param t save those value i.e token value in some variable.please help how can i pass that particular value into another script which is dependent.

i have tried below script

if (atoi(lr_eval_string("{SecurityToken}")) > 0)
    {
        lr_end_transaction("01_Cards",LR_PASS);
        lr_output_message(lr_eval_string("Value of Security Token is : {SecurityToken}"));
    }
    else
    {
        lr_end_transaction("01_Cards",LR_FAIL);
        lr_output_message(lr_eval_string("Value of Security Token is : {SecurityToken}"));
    }

解决方案

Your management owes you training and a mentor. You may find this statement infuriating, but it is your management who is setting you up for issues. This is from someone with two decades of experience in this field and who has over a thousand answered questions per year online on the topic of performance testing with and without LoadRunner involved. You can also find a podcast which is directly related to this discipline at http://www.perfbytes.com

Virtual Table Server is the mechanism to do this in LoadRunner. If you do not want to use VTS then you can use other service brokers to handle this. Solutions have been built around MYSQL, RabbitMQ, ORACLE and SQL Server Queue Tables, etc... The architecture of this solution is Virtual user A writes to a queue. Virtual user B, which you are trying to pass the data to, "pops" the next value from the queue. The service oriented architecture of the queue handles the appropriate managing of lock for push onto the queue and pop from the queue for multiple users.

What you cannot do successfully is write to a common file or to a parameter file for another user. This will not work for a half a dozen different reasons related to locking on multiple user access for read/write and delete as well as when and how the parameter files are loaded and addressed by virtual users.

这篇关于如何在loadrunner中将一个脚本变量值传递给另一个脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆