Jmeter with Power shell is running the scripts but the end of the scripts I'm getting errors, it's not generating reports files and not creating an output folder as well, I'm running Jmeterusers.jmx file through Power Shell...
power Shell code is ...
jmeter_test.ps1
10.10.10.120
#Remove Last Test Reults #Start-Sleep -Seconds 15600
$ResultPath = "results/testresults.jtl" if (Test-Path $ResultPath) { Remove-Item $ResultPath
for ($i = 1; $i -le 1; $i++) #9 for overnight {
jmeter -nt Jmeterusers.jmx -1 results/testresults.jtl #JVM_ARGS="-Xms2g -Xmx8g" jmeter -n -t Jmeterusers.jmx -1 results/testresults.jtl #jmeter-server.bat -n -t Jmeterusers.jmx -1 results/testresults.jtl # -R 10.85.34.175,10.85.34.194,10.85.34.182,10.85.34.195
}
1 $FilteredPath = "results/filtered.jtl"
if (Test-Path $FilteredPath) {
Remove-Item $FilteredPath
}
#C:/Users/testuser/Desktop/apache-jmeter-5.3/bin/FilterResults.bat --output-file $FilteredPath --input-file $OutputPath --exclude-label-regex true -- exclude-labels "Login User." FilterResults --output-file $FilteredPath --input-file $ResultPath --exclude-label-regex true --exclude-labels "Login User."
Write-Output "Done"
And the Below is Jmeter.Log details..
2023-07-06 09:34:17,234 INFO o.a.j.r.d. ReportGenerator: ReportGenerator will use for Parsing the separator: ', 2023-07-06 09:34:17,234 ERROR o.a.j. JMeter: An error occurred: java.lang.IllegalArgumentException: Cannot read test results file: results \filtered.jtl
at org.apache.jmeter.report.dashboard. ReportGenerator.(ReportGenerator.java:133) ~[Apache JMeter_core.jar:5.2.1] at org.apache.jmeter. JMeter.start(JMeter.java:542) [Apache JMeter_core.jar: 5.6]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_261] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_261]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_261] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_261]
at org.apache.jmeter. NewDriver.main (NewDriver.java:259) [Apache JMeter.jar: 5.6]
And Here is final output on power shell Screen
FilterResults: The term 'FilterResults' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling th was included, verify that the path is correct and try again. C:\Users\testuser\Desktop\jmeter_tests.ps1:30 char:1 FilterResults --output-file $FilteredPath --input-file $ResultPath
: ObjectNotFound: (FilterResults: String) [], CommandNotFoundException FullyQualifiedErrorId : CommandNotFoundException
error occurred: Cannot read test results file: results\filtered.jtl errlevel=1
press any key to continue...
I tried several ways, changing/adding some of the .jar files, Changing the code in .Ps file, and so on...
This bit:
The term 'FilterResults' is not recognized as the name of a cmdlet
means that your (however I doubt that it's really yours) powershell script fails to locate FilterResults.bat
file under operating system PATH so the options are in:
-f
command-line argument JMeter will overwrite the .jtl results file and the dashboard folder with the new results.