cancel
Showing results for 
Search instead for 
Did you mean: 

Script within DataGen test step

SOLVED
Occasional Contributor

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?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Manager

Re: Script within DataGen test step

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))

 

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
5 REPLIES 5
Community Manager

Re: Script within DataGen test step

Hi Catch22,

 

Could you please check if you see the same behavior in our latest Ready! API maintenance build? Perhaps, this issue has already been fixed there.

You can download the build here: https://support.smartbear.com/downloads/readyapi/nightly-builds/

 

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
Occasional Contributor

Re: Script within DataGen test step

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

Community Manager

Re: Script within DataGen test step

Thanks for checking.

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

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
Highlighted
Community Manager

Re: Script within DataGen test step

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))

 

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
Occasional Contributor

Re: Script within DataGen test step

Thanks! That fixed the issue

New Here?
Join us and watch the welcome video:
6 / 7 API Testing Mistakes Video
Top Kudoed Authors