在 Visual Studio 中为 REST Api 负载测试选择哪个测试组合模型选项? [英] Which test mix model option to select for REST Api Load Testing in Visual Studio?

查看:25
本文介绍了在 Visual Studio 中为 REST Api 负载测试选择哪个测试组合模型选项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了 WebTest 文件,现在使用 WebTest 文件添加新的负载测试.WebTest 文件包含我的会话的 api 快照,该会话执行多个 REST API,包括 Post、Get 等.Web 性能测试成功通过.

I have created the WebTest file and now adding new Load Test using the WebTest file. The WebTest file contains api snapshot of my session that performs several REST Apis including Post, Get, etc. The Web Performance test is passing successfully.

我正在使用 Visual Studio 中的负载测试向导创建负载测试,我被要求选择测试组合模型,如屏幕截图所示:

I am creating the Load Test using Load Test Wizard in Visual Studio where I am asked to pick up Test Mix Model as shown in screenshot:

您的负载测试场景有以下测试组合模型选项:

There are following test mix model options for your load test scenario:

  1. 基于测试总数

  1. Based on the total number of tests

基于虚拟用户数

根据用户节奏

按顺序排列

我参考了官方 文档,但我不能仍然了解要使用哪种模型组合以及每种组合产生的差异和性能影响是什么?

I referred the official documentation but I am not able to understand still which model mix to use and what is the difference and performance impact each mix create?

推荐答案

由于您只有一个 Web 测试,所以我建议使用基于测试数量的测试组合.但实际上除了用户节奏之外的任何组合都应该是合适的.

As you only have one web test then I would suggest using the test mix based on number of tests. But actually any mix except user pace should be suitable.

四种测试混合物的行为如下所述.我建议仔细阅读问题截图中显示的单词,以及其他组合的相关单词.这些词上面的图表旨在说明混合的工作原理.

The four test mixes behave as described below. I recommend careful reading of the words shown in the screenshot in the question, and the related words for the other mixes. The diagram above those words is intended to suggest how the mixes work.

由于只有一个网络测试,顺序"组合没有用处.它仅在您有多个测试(例如,ABC)并且需要在其中重复运行时使用每个虚拟用户 (VU) 的顺序(即 ABCABCABC ... ABC).

As there is only one web test, the "sequential order" mix is not useful. It is only used when you have more than one test (e.g., A, B and C) and they need to be run repeatedly in that order (i.e. A B C A B C A B C ... A B C) by each virtual user (VU).

当您希望 Web 测试以固定速率(每小时 N 次)运行以向被测系统施加稳定负载时,可以使用用户步调"组合.假设测试 D 需要大约 40 秒来执行,并且速度设置为每小时 30 次测试.然后我们期望系统启动,对于每个 VU,每 2 分钟进行一次测试(因此在执行之间获得大约 100 秒的空闲时间).现在假设还有一个测试 E 需要大约 15 秒来执行,并且它的速度设置为每小时 90.然后每个 VU 应该每 40 秒额外运行一次测试 E.所以现在每个 VU 都以这些速率运行测试 DE.测试 D 想要每个 VU 时间每小时 30 * 40 秒,测试 E 想要 90 * 15 秒,因此我们使用了 30*40+90*15 = 2550 秒每个小时.所以每个 VU 都有足够的时间来运行这两个测试.如果测试需要更长的时间或需要更快的速度,那么每小时可能需要超过 3600 秒.这是不可能的,我希望在测试运行时看到有关它的错误或警告消息.

The "user pace" mix is used when you want a web test to be run a fixed rate (of N times per hour) to apply a steady load to the system under test. Suppose test D takes about 40 seconds to execute and the pace is set to 30 tests per hour. Then we expect the system to start, for each VU, that test every 2 minutes (and hence get about 100 seconds idle between executions). Suppose now that there is also test E that takes about 15 seconds to execute and its pace is set to 90 per hour. Then each VU should additionally run test E every 40 seconds. So now each VU runs tests D and E at those rates. Test D wants 30 * 40 seconds per hour of each VUs time and test E wants 90 * 15 seconds, thus we have 30*40+90*15 = 2550 seconds used of each hour. So each VU has plenty of time to run both tests. Should the tests take much longer or require a faster rate then that might take over 3600 seconds per hour. That is impossible and I would expect to see an error or warning message about it as the test runs.

当您希望尽快运行 Web 测试(在指定的 VU 数量内并考虑到思考时间)时,可以使用其他两种测试组合.区别在于如何选择运行 Web 测试.当只有一个网络测试时,这两种混合具有相同的效果.对于多个 Web 测试,一种混合​​尝试使执行的 Web 测试的数量与混合中指定的比率(百分比)相匹配.另一种组合试图使运行每个测试的 VU 数量与比率匹配.

The other two test mixes are used when you want to run web tests as quickly as possible (within the number of VUs specified and allowing for think times). The distinction is how web tests are chosen to be run. When there is only one web test then the two mixes have the same effect. With more than one web test one mix tries to make the number of web tests executed match the ratios (percentages) specified in the mix. The other mix tries to make the number VUs running each test match the ratios.

假设我们有测试:A 在 40%,B 在 30%,C 在 20% 和 D 为 10%.使用基于测试总数的测试组合,我们期望执行的每个测试的数量接近规定的百分比.假设我们有 20 个 VU 和一个基于用户数量的测试组合,那么我们期望 8 个 VU 运行测试 A,6 个 VU 运行测试 B,4 个 VU 运行测试 C 和 2 个 VU 来运行测试 D.

Suppose we have tests: A at 40%, B at 30%, C at 20% and D at 10%. With a test mix based on total number of tests we would expect the number of each test executed to approximate the stated percentages. Suppose we have 20 VUs and a test mix based on number of users then we would expect 8 VUs to run test A, 6 VUs to run test B, 4 VUs to run test C and 2 VUs to run test D.

这篇关于在 Visual Studio 中为 REST Api 负载测试选择哪个测试组合模型选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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