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

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

问题描述

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

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.

由于只有一个Web测试,因此顺序顺序"混合是没有用的.仅当您有多个测试(例如ABC)并且每个虚拟用户(VU)需要以该顺序(即A B C A B C A B C ... A B C)重复运行它们时,才使用它.

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).

当您希望以固定速率(每小时N次)运行Web测试以向测试中的系统施加稳定的负载时,将使用用户进度"混合.假设执行测试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测试的数量与混合中指定的比率(百分比)相匹配.另一种方法是尝试使运行每个测试的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天全站免登陆