尝试在jmeter中使用OS进程采样器运行Shell脚本时出错

时间:2019-01-30 07:34:45

标签: shell testing jmeter

one.jmx文件带有命令行参数,因此我将long命令放在外壳脚本(RUN_GET_CALLS.sh)中运行one.jmx。现在我正在使用Two.jmx,它使用OS进程采样器通过shell脚本调用One.jmx。 当我执行Two.jmx时出现错误

timeStamp,elapsed,label,responseCode,responseMessage,threadName,dataType,success,failureMessage,bytes,sentBytes,grpThreads,allThreads,URL,Latency,IdleTime,Connect
1548833794770,4,"Patient_""_id""",500,"Exception occurred whilst executing system call: java.io.IOException: Cannot run program ""bash /home/ubuntu/HSDP_Suit/TestSuite/JMX_files/RUN_GET_CALLS.sh"" (in directory ""/home/ubuntu/JMeter/apache-jmeter-5.0/bin""): error=2, No such file or directory",Patient 1-4,text,false,,0,0,6,6,null,0,0,0

enter image description here

我也尝试将路径放在“工作目录”框中,但它不起作用

1 个答案:

答案 0 :(得分:1)

您的语法有点不正确,您应按以下方式配置OS Process Sampler

  • 命令:/bin/bash
  • 工作目录:/home/ubuntu/HSDP_Suit/TestSuite/JMX_files
  • 参数1:-c
  • 参数2:./RUN_GET_CALLS.sh ${PROPERTY_FILE} ${RESOURCE} ${PARAMETERS_STRING} ${FILE_NAME} ${RESULT_FILE}

示例配置屏幕截图:

enter image description here

按照bash man page

  

-c 字符串

     

如果存在 -c 选项,则从字符串中读取命令。如果字符串后面有参数,则将其分配给位置参数,从 $ 0 开始。

更多信息:How to Run External Commands and Programs Locally and Remotely from JMeter