Need a Unique Nick Name with TimeStamp

Hi Community.
Need your help in generating below two Outputs:

  1. Need a Unique Bank NickName everytime for entering Data in a Bank Account.
  2. Need a Unique Insured Name with CurrentDateTimeStamp.

Please advise.

1 Like

hey @dsingh1 you can use faker for that kind of problem

    Faker faker = new Faker();
	String tenRandomNumber = faker.number().digits(10)
	String firstNameRandom = faker.name().firstName()

Does it requires any library to imported?

I was trying this:
int RN = (int)(Math.random()*500)

Getting errors as below:


Getting below error using the Faker() method

If you are missing import statement, then try CTRL + SHIFT + O (oh) to adjust your import statements to include those you are missing and remove those you do not need.

import com.github.javafaker.Faker

or, for random, I use:

import java.util.Random

Maybe like:
Random rand = new Random();
upperLimit =  WebUI.getNumberOfTotalOption(findTestObject('myPage/select_AssignedTo'));
choice = rand.nextInt(upperLimit)
WebUI.selectOptionByIndex(findTestObject('myPage/select_AssignedTo'), "${choice}")
WebUI.verifyOptionSelectedByIndex(findTestObject('myPage/input_AssignedTo'), "${choice}", 10)

but there is also:

import org.apache.commons.lang.RandomStringUtils as RandStr

Possibly you want “fake data”, not “Nick Name”.

Possibly you want this library :

Download the jar from https://mvnrepository.com/artifact/com.github.javafaker/javafaker/1.0.2

Save it into the Drivers folder of your project

Close/reopen your project.

Thanks @kazurayam