Powershell give a performance team a great opportunity to automate complete test execution run.
In this blog i will show you how easy is to set up and run jmeter file with local and global properties.
Jmeter
Jmeter is run from powershell where parameters can be read and data can be prepared for test execution.Parameters when jmeter test is run:
- --nongui; jmeter is run in non gui to save memory and CPU usage
- --runremote; gives a possibility to run on remote host on which jmeter_server is running
- --testfile; which jmx file will be used in test, i usually copy original file to .bkp and used it for testing
- --logfile; where to write a log file
- --jmeterlogfile; all data shown on the screen are saved in file with name
- --globalproperty: is used to share properties along remote hosts
- --jmeterpoperty: is used on this machine and is not send to remote hosts
Option --rurmote can be used also on same machine from which jmeter test are started, with running jmeter_server.bat in background. This sometimes have impact on performance of machine when a lot of machines are included in remote.
Most of my test are run on different sets of remote hosts, depends what i need to identify of artifacts from the tests. For example, how many stored procedures was executed, check duration of each API call, etc.....
Example of code in powershell to run jmeter test:
cmd.exe /c jmeter.bat --nongui -JforcePerfmonFile=true --runremote --testfile "$global:TestName.jmx.bkp" `
--logfile "$JMeterReportFileFolder\$($global:TestName)-output.jtl" `
--jmeterlogfile "$JMeterReportFileFolder\$($global:TestName)-jmeter.log" `
--globalproperty LogDir="$($JMeterReportFileFolder)\" `
--globalproperty "Jmeter\$global:TestCaseName\$($global:TestCaseName) - General.properties" `
--globalproperty "Jmeter\$global:TestCaseName\$($global:TestScenario).properties" `
--globalproperty "Jmeter\$global:TestCaseName\$($global:TestScenario)_Thread.properties" `
--globalproperty "Jmeter\$global:TestCaseName\$($global:TestScenario)_Timeouts.properties" `
--globalproperty "Jmeter\$global:TestCaseName\$($global:TestScenario)_THT.properties" `
--globalproperty "perf.properties" `
--jmeterproperty "remote_hosts=$($global:Remote_Hosts)" `
--globalproperty "ServerRun=$($global:Remote_Hosts)"
Ni komentarjev:
Objavite komentar