I need to know how to log an error when a JDBC request returns no data from DB in Jmeter.
I have got:
JDBC request
Query:
SELECT names
FROM customers
Variable names: namesCustomers
Then I have got a BeanShell postProcessor with script:
import org.apache.jmeter.util.JMeterUtils;
JMeterUtils.setProperty("namesCustomer", vars.get("namesCustomer_1"));
And finally a simple controller called "set variables" which calls an external file with the following code: vars.put("namesCustomer",JMeterUtils.getProperty("namesCustomer"));
The problem is that in another SOAP request I am using the variable namesCustomer_1, and if no data is returned from DB this request fails. I need to log an error when the JDBC returns no data.
If I add to the post processor:
log.error("Error example");
I see the error logged in jmeter.log when this request is ran. I need something like:
if(JMeterUtils.setProperty("namesCustomer", vars.get("namesCustomer_1")).toString().length()==0){
log.error("DB returned no results")
}
Any Ideas on how to log an error when the JDBC request returns no data?