如何将用户定义的变量值限制为jmeter中的特定线程组

How to restrict user defined variable value to specific thread group in jmeter

在我的 jmeter 脚本中,我分别有 2 个线程组和用户定义变量。在用户定义的变量中,我使用的是名称,但在每个线程组中具有不同的值。当我 运行 jmx 文件时,我看到第二个线程组的值覆盖了第一个线程组。我需要 运行 具有相同用户定义变量名称的不同值的线程组。请求帮助我解决这个问题。以下是 jmx 文件如何设计的示例屏幕截图。

根据User Defined Variarbles documentation

For defining variables during a test run, see User Parameters. UDVs are processed in the order they appear in the Plan, from top to bottom.

For simplicity, it is suggested that UDVs are placed only at the start of a Thread Group (or perhaps under the Test Plan itself).

所以我认为您应该考虑迁移到 User Parameters

查看 A Quick Guide to JMeter PreProcessors for comprehensive information on User Parameters and other Pre-Processors 中的详细说明、示例等