Simple Variable Random Code

Ask general questions here.
kieranwood
Posts: 15
Joined: Fri Jan 23, 2015 12:31 pm

Simple Variable Random Code

Post by kieranwood » Mon Jun 29, 2015 4:37 pm

Hi there,

I would like to add a random number to the input of a test case I am attempting to run.

I would like it so it outputs a random number from a selection. i.e. test88

Is there a simple way of doing this in the code?

Thanks

afleitas
Certified Professional
Certified Professional
Posts: 26
Joined: Thu May 14, 2015 3:57 pm

Re: Simple Variable Random Code

Post by afleitas » Mon Jun 29, 2015 7:22 pm

Hello There,

If I were you I would look into the Random() class.

http://stackoverflow.com/questions/1353 ... rator-work

Please see example below that just creates a messagebox that has a Ran number in it. You can change this and implement however you would like.
Attachments
RanMethod.png
RanMethod.png (4.27 KiB) Viewed 833 times
Normal people... believe that if it ain't broke, don't fix it. Engineers believe that if it ain't broke, it doesn't have enough features yet.
-Scott Adams :)

kieranwood
Posts: 15
Joined: Fri Jan 23, 2015 12:31 pm

Re: Simple Variable Random Code

Post by kieranwood » Tue Jun 30, 2015 8:27 am

Hi there,

Thanks for that. After some playing I was able ot understand how to implement this weithin a test case step.

Kind regards