jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nitin <nitin.cool4urc...@gmail.com>
Subject Re: how to use properly vars function
Date Thu, 31 Dec 2015 16:34:51 GMT
I believe its' very confusing to both "timestamp_starts" and "timestamp_start".
Please fix this.

Secondly, try changing

${__javaScript("${timestamp_start}" <=  "${timestamp_end}")}

to

${__javaScript(${timestamp_start} <=  ${timestamp_end})}


Thanks

On Thu, Dec 31, 2015 at 9:50 PM, Erez Naim <Erez@theneura.com> wrote:

> 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  |
>
> [image: 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>
>
>
>
>
>



-- 
Regards
Nitin
Java | Php | Js | jQuery | Backbone | MongoDB developer and Webscraper
http://nitinsurana.com
Expert mentor at Codementor.io - https://www.codementor.io/coding_idiot

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