jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sankar Das <007bhabanisan...@gmail.com>
Subject BeanShell Assertion in jdbc request
Date Fri, 18 Nov 2016 14:15:49 GMT
Hello Everyone,

Getting two columns from a jdbc sampler  i.e ID and WF. Trying to fail it,
if it exceeds than the predefined variables by using beanshell.
Below is the sample code.

String myValue1 = vars.get("WF_1");
String myValue2 = vars.get("WF_2");
if(!myValue1.equals ("3")){
  log.info("myValue1 =" + myValue1);
  Failure = true;
  FailureMessage = " The database value should be " + myValue1 + ".";
}
else if(!myValue2.equals ("5")){
  //log something
  Failure = true;
  log.info("myValue2 =" + myValue2);
   FailureMessage = " The database value should be " + myValue2 + ".";

else {
  //can be log something?
     Failure = false;


}
Above code is working when I know the number of rows for a particular
column. If the rows values are dynamic and increasing or decreasing
according to sysdate than how to compare them with the predefined and fail
the sampler.

Please help!

Thanks!

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message