JMeter 测试的 DRY

发布于 2024-08-04 07:04:51 字数 239 浏览 1 评论 0原文

有没有一种方法可以模块化 JMeter 测试。

我为我们的应用程序记录了几个用例。它们每个都位于同一测试计划中的单独线程组中。为了控制工作流程,我编写了一些在许多线程组中使用的原语(例如后处理器元素)。

有没有办法不将这些元素复制到每个线程组中,而是在同一测试计划中使用某种引用?同样有用的是一种引用不同文件中的元素的方法。

有没有人有任何解决方案或解决方法。我想我不是唯一一个尝试遵循 DRY 原则的人......

Is there a way to modularize JMeter tests.

I have recorded several use cases for our application. Each of them is in a separate thread group in the same test plan. To control the workflow I wrote some primitives (e.g. postprocessor elements) that are used in many of these thread groups.

Is there a way not to copy these elements into each thread group but to use some kind of referencing within the same test plan? What would also be helpful is a way to reference elements from a different file.

Does anybody have any solutions or workarounds. I guess I am not the only one trying to follow the DRY principle...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

喵星人汪星人 2024-08-11 07:04:51

我认为 Atlassian 的这篇文章描述了您使用模块控制器后的需求。我自己还没有尝试过,但已将其列入我要做的事情列表中:)

http://blogs.atlassian.com/developer/2008/10/performance_testing_with_jmete.html

贾里德

I think this post from Atlassian describes what you're after using Module controllers. I've not tried it myself yet, but have it on my list of things to do :)

http://blogs.atlassian.com/developer/2008/10/performance_testing_with_jmete.html

Jared

祁梦 2024-08-11 07:04:51

您无法使用 JMeter 执行此操作。用户界面不支持它。工作台将是存储这些常见元素的完美位置,但它不会保存在 JMX 中。

但是,您可以对任何内容进行参数化,以便实现类似的效果。例如,我们在多个线程组中使用相同的正则表达式后处理器。尽管我们不能共享处理器,但整个表达式是测试计划中定义的参数,它是共享的。当正则表达式改变时,我们只需要改变一处。

他们正在讨论将 Workbench 保存在 Jmeter 的未来版本中。完成后,添加一些 UI 来引用 Workbench 中的元素就很简单了。

You can't do this with JMeter. The UI doesn't support it. The Workbench would be a perfect place to store those common elements but it's not saved in JMX.

However, you can parameterize just about anything so you can achieve similar effects. For example, we use the same regex post processor in several thread groups. Even though we can't share the processor, the whole expression is a parameter defined in the test plan, which is shared. We only need to change one place when the regex changes.

They are talking about saving Workbench in a future version of Jmeter. Once that's done, it's trivial to add some UI to refer to the element in Workbench.

居里长安 2024-08-11 07:04:51

模块控制器对于在不同线程组中执行相同的示例非常有用。

可以非常轻松地在多个线程组中使用相同的断言。

在测试计划级别,创建一组用户定义的变量,其名称如“Expected_Result_x”。然后,在您的响应断言中,只需引用变量名称 ${Expected_Result_x}。您仍然需要手动将断言添加到您想要特定断言的每个页面,但现在如果断言发生更改,您只需更改一个位置。

Module controllers are useful for executing the same samples in different thread groups.

It is possible to use the same assertions in multiple thread groups very easily.

At your Test Plan level, create a set of User Defined variables with names like "Expected_Result_x". Then, in your response assertion, simply reference the variable name ${Expected_Result_x}. You would still need to add the assertion manually to every page you want a particular assertion on, but now you only have to change it one place if the assertion changes.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文