Forum Discussion

chimas's avatar
chimas
Occasional Contributor
10 years ago

ReadyAPI 1.4.1 Inline Command is always executed

Hi   In Soapui I used to use this approach to create random user names. But it is not working as expected inside READY API.   Inside a SOAP request I have something like this:   <userName>User_...
  • TanyaYatskovska's avatar
    TanyaYatskovska
    10 years ago

    Hi Chimas,

     

    Our R&D team has found out that SoapUI and Ready! API work in the same way – a new value is generated each time they got access to userName.

    If the behavior is different in your case, could you please provide us with a sample project that demonstrates the differences between the products results?

  • TanyaYatskovska's avatar
    TanyaYatskovska
    10 years ago

    Jparel, I was informed that this behavior is related to the Groovy library update (2.1.7 for 5.1.2 and 2.4.4 for 1.5.0). Our team suggests that you update your groovy code to this:

    (int)(Math.random()*99999) + 10001

    Brackets must be around the code:

    Math.random()*99999

    Since Math.random() returns the pseudo random value from 0 till 1, when it casts to int it becomes 0! Therefore, you get 10001 every time.