jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Deepak Shetty <shet...@gmail.com>
Subject Re: Extracting Last 4 digits from Random number
Date Fri, 13 May 2011 22:18:07 GMT
Hi
${__Random(1000000,999999999999999,var1)}${__Random(1000000,999999999999999,var2)}
the first time you want to use it (no need for UDV).
This saves the digits into variables named var1 and var2.

${__javaScript("${var2}".substring("${var2}".length-4))} whenever you want
the last 4 digits

regards
deepak

On Fri, May 13, 2011 at 2:15 PM, Natasha Alexander
<naalix3731@hotmail.com>wrote:

>
> Hi everyone,
> I am very new to JMeter.  Would someone be able to help me step by step
> with the following:
> 1. I need to generate a random number that may be a minimum of 14 digits
> and maximum of 30 digits long.
> [NOTE: Initially, I added a User Defined Variable under the Test Plan level
> with value:
> ${__Random(1000000,999999999999999)}${__Random(1000000,999999999999999)}
> But now I'm thinking maybe the way to go is by adding a Random Variable.
>  However, if this is the way to go, I'm not certain under which level in the
> tree the element should exist.]
>
> 2. Eventually, my script should be able to extract the last 4 digits of the
> random number that was generated.  This is because in the web application I
> am testing, the last 4 digits of that number will appear on a web page at
> some point.  I need to verify that the last 4 digits extracted matches what
> I see on that web page.
>
> I'd appreciate any help offered... step by step :-)
>
> Thanks in advance!
> Natasha

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