How to detect the test end while JMeter starts the test errors in Java
Expected behavior
No response
Actual behavior
I have a Java program that uses the StandardJMeterEngine runTest method to run tests. When the JMX file contains an errors that causes the StandardJMeterEngine notifyTestListenersOfStart method to throw an exception, similar to https://github.com/apache/jmeter/issues/6174, the NotifyTestListenersOfEnd method will not be called. As a result, my program cannot detect that the test has ended. How can I make my program detect that the test has ended in this scenario?
Steps to reproduce the problem
1.Create a JMX file with an error, for example by adding a variable ${__intSum(${__time(,)},-3600000,)}, which will throw a NumberFormatException. 2.Run the JMX using the StandardJMeterEngine runTest method.
JMeter Version
5.6.2
Java Version
java version 17.0.6
OS Version
windows 10
StandardJMeterEngine engine = new StandardJMeterEngine();
if (engine.isActive()){
println("Jmeter is running");
}
StandardJMeterEngine engine = new StandardJMeterEngine(); if (engine.isActive()){ println("Jmeter is running"); }
This method is not useful because runTest is an asynchronous method, so I can't catch exceptions after calling runTest. My temporary solution is to compile hashTree once before runTest.
Yes, there is a question about the answer I provided, and I'll look into whether there is a good plan.
StandardJMeterEngine engine = new StandardJMeterEngine(); if (engine.isActive()){ println("Jmeter is running"); }This method is not useful because runTest is an asynchronous method, so I can't catch exceptions after calling runTest. My temporary solution is to compile hashTree once before runTest.