Visual Studio负载测试-将数据源与多个代理一起使用 [英] Visual Studio Load Test - Using Data Source with Multiple Agents

查看:112
本文介绍了Visual Studio负载测试-将数据源与多个代理一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Visual Studio 2015负载测试并正在运行已连接数据源的Web性能测试.数据源包含250个用户的用户登录信息.

I'm using Visual Studio 2015 Load Test and running a Web Performance test that has a data source connected. The data source contains user login information for 250 users.

在单个代理程序上按顺序运行此程序效果很好.但是,我试图添加10个测试代理以分担负载.通过设计,负载测试会将数据源复制到每个代理,然后它运行测试.最终发生的事情是,所有10个代理都使用数据源中的第1行用户来开始测试.我希望可以将负载测试设置为在所有代理上依次运行(例如:代理1使用第1行,代理2使用第2行,代理3使用第3行,依此类推……)

Running this in sequential order on a single agent works fine. However, I'm attempting to add in 10 test agents to share out the load. By design the Load Test copies the data source to each agent and it runs the test. What ends up happening is that all 10 agents start the test using the row 1 user from the data source. I'm hoping there's away to set up the Load Test to run sequentially across all agents (ex: Agent 1 uses row 1, Agent 2 uses row 2, Agent 3 uses row 3, etc...)

我怀疑没有设置此选项的选项,但想知道是否有人遇到此问题并提供解决方法.我确实通过 http://vsptqrg.codeplex.com

I suspect there's not an option to set this up, but wondered if anyone ran into this and had workarounds to offer. I did find this info via http://vsptqrg.codeplex.com

多台以钻机运行的机器

Multiple machines running as a rig

顺序-与您在一台计算机上的工作原理相同.每个代理都接收数据的完整副本,并且每个代理都以数据源中的第1行开始.然后,每个代理将遍历数据源中的每一行,并继续循环直到负载测试完成.

Sequential – This works that same as if you are on one machine. Each agent receives a full copy of the data and each starts with row 1 in the data source. Then each agent will run through each row in the data source and continue looping until the load test completes.

随机-这也和在一台计算机上运行测试一样.每个代理都会收到数据源的完整副本,并随机选择行.

Random – This also works the same as if you run the test on one machine. Each agent will receive a full copy of the data source and randomly select rows.

独特-此作品的工作方式略有不同.数据源中的每一行将使用一次.因此,如果您有3个代理,则数据将分布在这3个代理中,并且不会重复使用任何行.与一台机器一样,每行使用一次后,Web测试将停止执行.

Unique – This one works a little differently. Each row in the data source will be used once. So if you have 3 agents, the data will be spread across the 3 agents and no row will be used more than once. As with one machine, once every row is used, the web test will stop executing.

推荐答案

最接近您想要使用的是使用unique设置.但是,每个数据源行将仅使用一次,然后测试将停止.对于包含250行的数据源,将仅执行250次测试.指定unique时,我不知道数据源行到代理的确切分布.

The nearest you can get to what you want is to use the unique setting. However each data source row will only be used once, then the test will stop. With a data source containing 250 line only 250 test executions will take place. I do not know the exact distribution of data source rows to agents when unique is specified.

如果每个数据源行希望执行多个命令,则另一种方法是每个代理具有一个数据源列.使用agent_id选择列.使用sequential数据源访问.一种变化是在数据源中仅具有一组数据,但将agent_id附加到数据源中的某些值. 此答案在这些思想和代码上有所不同.

If more than one execution per data source row is wanted then another approach is to have one data source column per agent. Use the agent_id to select the column. Use the sequential data source access. A variation is to just have one set of data in the data source but append the agent_id to some of the values in the data sources. This answer has some variations on these ideas and some code.

另一种可能性是使用MoveDataTableCursor方法为每次测试执行设置特定的行.这可以在WebTestPluginPreWebTest方法中调用.该代码将使用上下文参数$AgentId$WebTestIteration.该调用将基于以下内容:

Another possibility is to use the MoveDataTableCursor method to set a specific row for each test execution. This could be called in a PreWebTest method of a WebTestPlugin. The code would use the context parameters $AgentId and $WebTestIteration. The call would be based the following:

MoveDataTableCursor(..., ..., $AgentId * NumberOfAgents + $WebTestIteration);

注意:

  • 上下文中的$AgentId$WebTestIteration的值是字符串,需要将它们转换为数字才能进行乘法和加法.
  • 还需要检查两个值是从零开始还是从一开始.
  • MoveDataTableCursor文档内容不是很丰富
  • The values of $AgentId and $WebTestIteration from the context are strings, they would need to be converted to numbers to do the multiply and add.
  • Would also need to check whether the two values are zero-based or one-based.
  • The documentation for MoveDataTableCursor is not very informative

这篇关于Visual Studio负载测试-将数据源与多个代理一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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