TestProject Forum

Generating random numerical strings

Hi,

How would you generate a random numerical string to parameterise? I have the UTC time add on which has got me past a couple of scenario’s but the data I need is getting a bit more complex.

For example I would like to do the following:

TypeText

Auto<random 9 digit numerical string>@harcoded.emaildomain.com

So in essence the username I create during each iteration is unique however the “Auto” part is constant and the email domain is constant?

Thanks in advance

Jamie

Hi @Jambo1972 .

To achieve that, please try following these steps:

  • First, let’s generate a random 9 digits number using the action “Random number in a range”, by generating a number between 100000000 and 999999999 - and let’s store the result into a parameter. Like this:

  • Then, we will concatenate the generated number to the string “Auto” and save the output into a parameter. This is how you can do that:

  • Finally, we will add the email domain to the string and save the whole mail into a new parameter:

Let me know if it helped :slight_smile:

Kind Regards,
Ricardo.

1 Like

Ok thanks will give this a go!

Hi Ricardo

I dont see that “random number in a range” action in the dropdown for actions?

image

Is this in the latest version?

Thanks
Jamie

Hi @Jambo1972 .

Instead of adding a new step by freezing an element, please try to add a step manually from here:

Then you should be able to see the action.

1 Like

Hi Ricardo

This is working fine however the random number being generated is always the default value = 0

Thanks
Jamie

Hi Ricardo

I managed to fix it the date range was not correct.

Thanks
Jamie