简体   繁体   English

尝试使用Docker容器为JMeter(非GUI模式)运行JMeter测试会引发错误“无法打开xxxx.jmx文件”

[英]Trying to run a JMeter test using a docker container for JMeter (non GUI mode) throws error “Could not open xxxx.jmx file”

I am trying to distribute loading tests using Docker containers. 我正在尝试使用Docker容器分发加载测试。

At local in JMeter, my tests run correctly in GUI or non GUI mode, but when I try to run any of them in non GUI mode using a docker image for JMeter: 在JMeter的本地,我的测试在GUI或非GUI模式下正确运行,但是当我尝试使用JMeter的docker镜像在非GUI模式下运行它们时:

docker run egaillardon/jmeter -n -t ~/Developer/testing/login_test.jmx -l ~/Desktop/resultado.jtl

I get the error: 我收到错误:

Could not open ~/Developer/testing/login_test.jmx 无法打开〜/ Developer / testing / login_test.jmx

I tried with different docker images for JMeter (egaillardon/jmeter, justb4/jmeter, vmarrazzo/jmeter) and I got the same error in any of them. 我试过JMeter的不同(egaillardon/jmeter, justb4/jmeter, vmarrazzo/jmeter)图像(egaillardon/jmeter, justb4/jmeter, vmarrazzo/jmeter) ,我在其中任何一个都得到了相同的错误。 Anyone knows what I have to change in my jmx file to do it readable? 任何人都知道我必须在我的jmx文件中更改它以使其可读吗?

I already tried with this solution in Stack Exchange but none worked for me. 我已经尝试在Stack Exchange中使用此解决方案,但没有一个对我有用。

You can also mount the host directory to the default working directory ( /jmeter ) in the container. 您还可以将主机目录安装到容器中的默认工作目录( /jmeter )。

Example : 示例:

docker run --detach --rm --volume `pwd`:/jmeter egaillardon/jmeter-plugins --nongui --testfile test.jmx --logfile result.jtl


By doing so, the jmeter run log file ( jmeter.log ) will also be created in the host directory. 通过这样做,jmeter运行日志文件( jmeter.log )也将在主机目录中创建。

In addition, to address issue regarding file permissions, you can also assign the user id and the group id of the user on the host to the jmeter user inside the container. 此外,要解决有关文件权限的问题,还可以将主机上用户的用户ID和组ID分配给容器内的jmeter用户。

Example : 示例:

docker run --env JMETER_GROUP_ID=`/usr/bin/id -g` --env JMETER_USER_ID=`/usr/bin/id -u` --rm egaillardon/jmeter --server -Jserver.rmi.ssl.disable=true

~/Developer/testing/login_test.jmx would be loaded from the container filesystem perpective, chances are that this path does not exist within your container filesystem. ~/Developer/testing/login_test.jmx将从容器文件系统中加载,很可能是容器文件系统中不存在此路径。

To overcome this, you could mount this file from your host filesystem into your container filesystem with a docker volume : 为了克服这一点,你可以从你的主机文件系统的文件安装到与您的容器文件系统搬运工量

docker run -v ~/Developer/testing/:/workspace egaillardon/jmeter -n -t /workspace/login_test.jmx -l /workspace/resultado.jtl

Explanations 说明

  • -v ~/Developer/testing/:/workspace : mount the ~/Developer/testing/ directory from your host to the path /workspace/ in the container filesystem -v ~/Developer/testing/:/workspace :将~/Developer/testing/目录从主机挂载到容器文件系统中的路径/workspace/
  • -n -t /workspace/login_test.jmx -l /workspace/resultado.jtl : options passed to the container processus (jmeter) at runtime, and thus in the context of the container. -n -t /workspace/login_test.jmx -l /workspace/resultado.jtl :在运行时传递给容器processus(jmeter)的选项,因此在容器的上下文中。 We need to adjust paths so that they match the location we chose when configuring the volume. 我们需要调整路径,使它们与我们在配置卷时选择的位置相匹配。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 azure 管道中使用 jmx 文件运行 JMeter 有/没有 docker - How to run JMeter using jmx file in the azure pipelines with/out docker 将通过以非GUI模式运行脚本而生成的jmeter主容器结果(Docker)复制/共享到EC2实例的命令 - Command to Copy/share jmeter master container results (Docker) generated in by running the script in non-gui mode to EC2 instance 使用 JMeter Docker 镜像,Prometheus 抛出 ConversionException - Using JMeter Docker image, Prometheus throws ConversionException runningj ustb4/jmeterwith docker 时遇到问题——我正在尝试在 windows 系统中使用另一个容器 localhost:55001 运行 jmeter 容器 - Facing issue while runningj ustb4/jmeterwith docker -- I am trying to run jmeter container with another container localhost:55001 in windows system 将 JMeter 插件与 justb4/jmeter Docker 图像一起使用会导致错误 - Using JMeter plugins with justb4/jmeter Docker image results in error 无法在 docker 中运行 jmeter 测试,得到 class 未找到异常 - Unable to run jmeter test in docker, getting class not found exception Docker 容器未完成 HTTP 在 JMeter 中发布音频文件 - Docker container doesn't finish with with HTTP POST audio file in JMeter 连接到 jmeter 从站 docker 容器时出现连接被拒绝错误 - Connection refused error while connecting to jmeter slave docker container 在 Docker 容器中使用 JMeter Prometheus 插件(连接被拒绝) - using JMeter Prometheus plugin within a Docker container (connection refused) 使用 Docker 运行 Jmeter Webdriver 测试给了我CannotResolveClassException - Running Jmeter Webdriver test using Docker gives me CannotResolveClassException
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM