namisang 发表于 2009-1-5 13:33:05

【推荐原文】LoadRunner 9: Simulate Parameters

作者: Ron Foster
推荐理由:关于LoadRunner模拟参数
请查阅 http://www.loadtester.com/lr9simulateparam.php


Anyone who has written a script in LoadRunner has probably used parameters before. A parameter is a substitution for a hard coded values when there needs to be different data values submitted on each new iteration if the script. One way to feed new information in is by creating a data file (similar to a CSV delimited file). You can create your own .DAT files with multiple columns, convert them from excel spreadsheets, or from SQL extracts from the database.Then point your parameter to the .DAT file. HP's Virtual User Generator (VuGEN) scripting tool for LoadRunner has multiple options for choosing which data will be selected upon each new iteration. Select the drop down menu for "Select next row" and you will see the following choices:

Sequential
Random
Unique
Same Line as (if there are multiple parameters in the script)
Check out the LoadRunner books online or help documentation if you need details on how these choices work and how to get there in VuGEN.

With a larger data set, you might want to visualize just how random the "Random" option is -how LoadRunner will use these data values throughout the duration of the test. With LoadRunner 9 we have a new feature, Simulate Parameter, to do that. When you look at the Parameter Properties sheet, there is a new button. See the graphic #1 below:






In this particular case I want to see how often my users will be chosen for logging in throughout the test if I have a load of 10 virtual users iterating 10 times each. By clicking on the "Simulate Parameter" button, it launches the Parameter Simulation sheet, which will allow me to select the number of virtual users I plan on running, and the number of iterations. I can also tell it to look at the current Run-Time setting values I have set up in the script for this information. See graphic #2 below:




Now I have an idea of how the test scenario will play out by virtual user, and by iteration. This would help if you suspected that you had too few values in your parameter file and the timings were getting skewed. It you were getting errors within scripts, you might find out that its due to database locks because the same data is being used at the same time, or some other data violation. Note that by viewing this, it does not modify the data file to match the listing you see. It's simply a way to see how the data would be used if you kicked off a test. Now you have a way to visualize a dry run on those Parameters without launching a test.

[ 本帖最后由 namisang 于 2009-1-5 13:34 编辑 ]

fishy 发表于 2009-1-7 12:17:41

参数模拟(Parameter simulator),是LR9的新特性之一,可用于模拟Controller运行脚本时读取参数表格数据的情形,从而可在让脚本编写人员在VuGen中编写脚本时就设计和调整好数据。

例如在脚本中有个用户名需要参数化,我们在参数列表中增加参数并添加好数据后,可以单击“Simulate Parameter…”按钮,调出参数模拟界面。



如果设计的数据只有4条,而模拟Controller中的场景运行时设置的Vusers数量是5,则会看到最后一个Vuser没有对应的数据,这必然会导致测试运行失败。



由此可见,通过参数模拟,可以预先知道参数设计是否合理,避免在Controller设计场景并运行测试后才发现数据设计的缺陷。

fishy 发表于 2009-1-7 12:18:56

觉得两篇文章很类似。。。。
页: [1]
查看完整版本: 【推荐原文】LoadRunner 9: Simulate Parameters