Forum Discussion

catch22's avatar
catch22
Occasional Contributor
9 years ago

Script within DataGen test step

This is an example of one of many small scripts I have within a DataGen test step to generate a single property:

 

((int)Math.random()*(1999999999-1900000000)+1900000000)

 

In Ready API 1.4.1

Last value returned: 1918229662 (generates a new random value each time)


In Ready API 1.5.0

Last value returned: 1900000000 (same value returned each time)

 

Is this a Ready API 1.5.0 bug?

Or perhaps there some setting that I must enable in Ready API 1.5.0 to get the same result?

  • TanyaYatskovska's avatar
    TanyaYatskovska
    9 years ago

    Hi David,

     

    I’ve got the news from our Team.

    In Ready! API 1.5, we moved to Groovy 2.4.4. Precedence of the cast operator was changed in this script version. You need to modify your line with this one:

    ((int)(Math.random()*(1999999999-1900000000)+1900000000))

     

    • catch22's avatar
      catch22
      Occasional Contributor

      I ran the test on a nightly build of Ready API 1.5.0 downloaded this morning 2016-01-28.

      I also ran the test on the Ready API 1.5.0 "public" build.

      Same result on both.

       

      Thanks

      David

      • TanyaYatskovska's avatar
        TanyaYatskovska
        SmartBear Alumni (Retired)

        Thanks for checking.

        I’ve reported this behavior to our R&D Team. Let’s wait for the results of their investigation.