# How to Generate a Phone Number in Leapwork?

Entering a Phone Number has become an essential component for a user to sign up on any web or desktop application. Users need to have a phone to receive important information such as Passwords, OTP's, account alerts, etc. Thus testing such flows is a must for ensuring a smooth User experience.

Creating random numbers for test cases can be a tricky experience for QA professionals and requires quite a bit of manual effort to set them up. This is especially true when a phone number inputted in an application must be unique. The application may throw an error if the same number is used repeatedly. Hence the process ends in a failed test case.

However, with the help of this **Phone Number generator**, we can generate a unique phone number complete with essential information like Country Code, Area Code, etc. With the use of this ready-to-use flow, QA testers can quickly scale up their testing abilities and can focus on more important aspects of the user experience.

### How to Generate a Phone Number in Leapwork?

A phone number is consists of 4 parts.

1. Country Code
2. Area Code
3. The next 3 digits are prefixed to narrow down the location
4. The last 4 digits of the phone number direct a call to a specific phone line.

In this flow, we can use the Country and Area code as per our requirement and we can combine the 3rd and 4th parts to create a unique phone number.

We can follow the following steps to Generate a Random Phone Number using Leapwork:

**STEP 1** –  We have to use the **Generate Number block** to generate the area code which consists of 3 digits.

**STEP 2**- We will have to again use another generate number block to generate the **3rd** and **4th** parts of the phone number.

**STEP 3** – We can then Pass the result values from both generate number blocks to Log message blocks in Text **Field 1** and **2** respectively.

**STEP 4** – In the respective log message block we can take the Country code for example **(+1)** as a hardcoded value according to your respective country code.

**STEP5** – In the end, we will concatenate **Field1** and **Field2** in the message column.

On successfully running our flow we would have successfully generated a phone number as shown in the image below.

### How can I use this flow?

You can easily use this ready-to-use flow by downloading the flow from **[here](https://support.leapwork.com/hc/article_attachments/4405434569106/Phonenumbergenerator.zip)** and [**importing**](https://support.leapwork.com/hc/en-us/articles/115003873052-How-to-Export-and-Import-automation-flows) it into your Leapwork Studio.

### Support:

For any clarification, please contact our **[Priority Support](mailto:prioritysupport@leapwork.com)** team.
