jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erez Naim <E...@theneura.com>
Subject how to use properly vars function
Date Thu, 31 Dec 2015 16:20:55 GMT
Hello all,

I am getting timestamp variable from the command line or a default one if none was delivered.

I am using this chunk of code under BeanShellPostProcessor:
import java.lang.*;

int timestampInt=0;
String timestamp="";

try{
timestamp=vars.get("timestamp_start");
timestampInt = Integer.parseInt(timestamp);
timestampInt+=1;
timestamp_start=Integer.toString(timestampInt);
System.out.println("After incremental of the variable: " + timestamp_start);

vars.put(timestamp_starts,"timestamp_start");
timestamp=vars.get("timestamp_starts");


}catch (Exception ex){
    log.warn("Error in my script", ex);
    throw ex; // elsewise JMeter will "swallow" the above exception
}


Then I am using a while controller where stop condition is as follows:
${__javaScript("${timestamp_start}" <=  "${timestamp_end}")}

However I noticed that timestamp doesn't increment and I get the same timestamp.

Any idea what could be the problem?

Thanks,

Erez Naim  |  QA Lead  |

[cid:image004.png@01D01E1B.5F153500]
EL AL 2 Street | Herzliya
mobile (+972) 50 9 555 686 | fax (408) 689.1366 | skype erez.neura


website<http://www.theneura.com/>  |  blog<http://www.startupbitz.com/>  |  twitter<https://twitter.com/intent/user?screen_name=theneura>
 |  map<http://goo.gl/maps/ZRkg5>




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