cancel
Showing results for 
Search instead for 
Did you mean: 

How to transfer some output to properties

Highlighted
Occasional Contributor

Re: How to transfer some output to properties

Anyone can help?
Highlighted
Super Contributor

Re: How to transfer some output to properties

Hi,

well, if you want it between 1 to 9, try using

def randomNumber = 1 + (int)(Math.random()*9)
...

or between 1000 to 9999, try using

def randomNumber = 1000 + (int)(Math.random()*9000)
...

etc.

regards,

/Ole
eviware.com
Highlighted
Occasional Contributor

Re: How to transfer some output to properties

Hi,

Thanks so much. I was try the

def n = (int)(10)
def randomNumber4 =(int)(Math.pow(10,n-1))+(int)(Math.random()*9*(Math.pow(10,n-1)))
def props = testRunner.testCase.getTestStepByName("Properties");   
props.setPropertyValue("randomValue4", String.valueOf(randomNumber4))


I find that if the n>=10, the random number is incorrect.  Is it exist a limit of properties.

..........

def n = (int)(11)
def randomNumber5 =(int)(Math.pow(10,n-1))
def props = testRunner.testCase.getTestStepByName("Properties");   
props.setPropertyValue("randomValue5", String.valueOf(randomNumber5))

If the n is 11, the value of randomNumber5 in properties is 2147483647. How to increase the limit of these properties?
Highlighted
Super Contributor

Re: How to transfer some output to properties

Hi!

try using long or double types instead.. !?

/Ole
eviware.com
Highlighted
Occasional Contributor

Re: How to transfer some output to properties

long or double types still not enoug, but I find another way to solve my problem.........anyways thank you so much for your help.
New Here?
Join us and watch the welcome video:
Top Kudoed Authors