将文件夹中的所有 jar 添加到 jmeter 类路径

Add all jars from a folder to jmeter classpath

我有一个 CI 服务器将几个应用程序 jar 及其各种依赖项转储到一个文件夹中。我正在尝试 运行 对 jmeter 类路径中的所有 jar 进行 jmeter 测试。

我可以将 jmeter 的 user.classpath 属性 设置为(半)冒号分隔的单个 jar 列表,但似乎不支持使用通配符。有没有办法将整个文件夹的 jar 添加到 jmeter 的类路径?

根据How to Use JUnit With JMeter guide:

You can also “tell” JMeter to look into additional locations via the “user.classpath” property. This property lives in the “user.properties” file under the /bin folder of your JMeter installation. It can take the following values:

  • Single jar file: user.classpath=/Projects/junit/test1.jar
  • Multiple jar files: user.classpath=/Projects/junit/test1.jar;/Projects/junit/test2.jar
  • A folder: user.classpath=/Projects/junit
  • Any combination of the above. Individual classpath entries need to be separated by semicolon or colon depending on underlying operating system

post 是关于 JUnit 的,但是 class 加载和 class 路径配置适用于任何外部 .jar 文件。

请记住,更改 classpath 不是动态过程,您需要重新启动 JMeter 才能选择任何新的 jar 或 属性 更改。