Да, Тони, ты точно можешь это сделать.Я использовал его в прошлом для одного из моих сценариев, и он работал.Вставка в файл .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 .со всеми результатами.