Batch file 通过单击运行JMeter脚本并生成结果

Batch file 通过单击运行JMeter脚本并生成结果,batch-file,jmeter,Batch File,Jmeter,我需要运行放置在XYZ位置的JMeter脚本,然后为不同的执行运行生成结果日期和时间。我们可以借助.BAT文件来完成吗 如果是,请在这方面帮助我。是的,托尼,你一定能做到。我过去曾在我的一个脚本中使用过它,它很有效。粘贴在下面的.bat文件内容中。对于.sh文件,您将不得不对可以用谷歌搜索出来的内容进行一些更改。下面是.bat文件的内容: @echo off set UserProperties="give user.properties file location here" set Sys

我需要运行放置在XYZ位置的JMeter脚本,然后为不同的执行运行生成结果日期和时间。我们可以借助.BAT文件来完成吗


如果是,请在这方面帮助我。

是的,托尼,你一定能做到。我过去曾在我的一个脚本中使用过它,它很有效。粘贴在下面的.bat文件内容中。对于.sh文件,您将不得不对可以用谷歌搜索出来的内容进行一些更改。下面是.bat文件的内容:

@echo off

set UserProperties="give user.properties file location here"
set SystemProperties="give system.properties file location here"

set /p ThreadGroup=Enter the number of virtual users: 
set /p RampUpTime=Enter the ramp up peroid: 
set /p LoopCount=Enter the loop count value: 
set /p BaseURL=Enter the base URL: 

mkdir local location\TestResult_%date:~-10,2%%date:~-7,2%%date:~-4,4%_%time:~0,2%%time:~3,2%%time:~6,2%  ---- Make a folder with timestamp appended to store in your result

set Output1="local location\TestResult_%date:~-10,2%%date:~-7,2%%date:~-4,4%_%time:~0,2%%time:~3,2%%time:~6,2%"

echo User Inputs Entered For The Test Are: >>%Output1%\TestInput_%date:~-10,2%%date:~-7,2%%date:~-4,4%_%time:~0,2%%time:~3,2%%time:~6,2%.txt
echo ThreadGroup=%ThreadGroup% >> %Output1%\TestInput_%date:~-10,2%%date:~-7,2%%date:~-4,4%_%time:~0,2%%time:~3,2%%time:~6,2%.txt
echo RampUpTime=%RampUpTime% >> %Output1%\TestInput_%date:~-10,2%%date:~-7,2%%date:~-4,4%_%time:~0,2%%time:~3,2%%time:~6,2%.txt
echo LoopCount=%LoopCount% >> %Output1%\TestInput_%date:~-10,2%%date:~-7,2%%date:~-4,4%_%time:~0,2%%time:~3,2%%time:~6,2%.txt
echo BaseURL=%BaseURL% >> %Output1%\TestInput_%date:~-10,2%%date:~-7,2%%date:~-4,4%_%time:~0,2%%time:~3,2%%time:~6,2%.txt

echo Test Input File has been placed at %Output1%

e: 
cd apache-jmeter-3.2\bin  ( Go to the bin folder where JMeter is installed)

jmeter -n -t E:\apache-jmeter-3.2\bin\scripts\SampleTestPlan.jmx -l E:\apache-jmeter-3.2\bin\results\TestResult_%date:~-10,2%%date:~-7,2%%date:~-4,4%_%time:~0,2%%time:~3,2%%time:~6,2%\TestResult_%date:~-10,2%%date:~-7,2%%date:~-4,4%_%time:~0,2%%time:~3,2%%time:~6,2%.csv -j E:\apache-jmeter-3.2\bin\results\TestResult_%date:~-10,2%%date:~-7,2%%date:~-4,4%_%time:~0,2%%time:~3,2%%time:~6,2%\Testlogs_%date:~-10,2%%date:~-7,2%%date:~-4,4%_%time:~0,2%%time:~3,2%%time:~6,2%.log -JThreadGroup=%ThreadGroup% -JRampUpTime=%RampUpTime% -JLoopCount=%LoopCount% -JBaseURL=%BaseURL%   ---- Finally run the command to start non gui mode execution.

因此,将在指定位置创建一个文件夹,其中包含输入文件、日志文件和包含所有结果的.CSV文件。

在您接受回答后,我编辑了您的标签和问题以删除
shell
.sh
“协助”意味着您自己做了一些工作,因此请分享!