JMeter - 运行 线程在本地和远程交替

JMeter - running thread in local and remote alternatively

我是 JMeter 的新手。 我的测试计划有 3 个部分。

  1. 在远程计算机上安装应用程序。 (我正在使用 OS 流程 执行脚本文件的采样器)
  2. 运行 来自本地机器的采样器。
  3. Post 在远程机器上测试设置。 (我正在使用 OS Process Sampler 来执行脚本文件)

我有 3 threads.Now 当我 运行 这个完整的计划时,我希望第一个线程 运行 在远程机器上,第二个线程在本地机器上,第三个线程在远程机器上再次机器。 我怎样才能实现它?

根据Wikipedia

In computer science, a thread of execution is the smallest sequence of programmed instructions that can be managed independently by a scheduler, which is typically a part of the operating system.

JMeter 线程基本上是 Java 线程,它们又是底层操作系统线程。因此你不能 运行 一个线程在一台机器上,另一个线程在另一台机器上。

你可以做的事情:

  1. 使用setUp Thread Group 在远程机器上设置应用程序。您可以使用 OS Process Sampler 启动本地程序,这将触发远程部署或类似的东西
  2. 程序启动后(您可以使用Timer to wait) if program from step 1 runs in background) you can execute main test logic in the main Thread Group
  3. 使用 tearDown Thread Group 来 运行 post 设置任务。

另一种选择是使用 JMeter Distributed Testing and have slaves on 1st and 2nd machine and some crazy logic in test which uses combination of i.e. If Controller and __machineIP() 函数,例如:

  • 如果本机IP == 10.10.10.1 - 运行那个sampler
  • 如果本机IP == 10.10.10.2 - 运行另一个采样器

但这是一种边缘情况。