# I have to create multiple users/logins and the software I’m testing doesn’t allow duplicates. How can achieve that by using the Record and Play functionality?

**URL:** <https://forum.katalon.com/t/i-have-to-create-multiple-users-logins-and-the-software-i-m-testing-doesn-t-allow-duplicates-how-can-achieve-that-by-using-the-record-and-play-functionality/6772>\
**Category:** Miscellaneous\
**Tags:** katalon-studio\
**Created:** [October 9, 2017, 10:59pm UTC](https://forum.katalon.com/t/i-have-to-create-multiple-users-logins-and-the-software-i-m-testing-doesn-t-allow-duplicates-how-can-achieve-that-by-using-the-record-and-play-functionality/6772 "2017-10-09T22:59:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![paolo\_addeo](https://avatars.discourse-cdn.com/v4/letter/p/6de8d8/32.png) [@paolo\_addeo](https://forum.katalon.com/u/paolo_addeo)\
**Post date:** [October 9, 2017, 10:59pm UTC](https://forum.katalon.com/t/i-have-to-create-multiple-users-logins-and-the-software-i-m-testing-doesn-t-allow-duplicates-how-can-achieve-that-by-using-the-record-and-play-functionality/6772/1 "2017-10-09T22:59:09Z")

</div>

As part of my regression testing I want to create multiple users/logins however the software I’m testing doesn’t allow duplicates, so as soon I have recorded the action of creating an user when trying to play back the test I’m getting a validation message due to the username already been used

---

<div class="post-metadata">

**Author:** ![katalon.team](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/katalon.team/32/21481_2.png) [@katalon.team](https://forum.katalon.com/u/katalon.team)\
**Post date:** [February 15, 2017, 3:57am UTC](https://forum.katalon.com/t/i-have-to-create-multiple-users-logins-and-the-software-i-m-testing-doesn-t-allow-duplicates-how-can-achieve-that-by-using-the-record-and-play-functionality/6772/2 "2017-02-15T03:57:27Z")

</div>

Hi,

You will need some little tricks in using the unique username in your case. Just need to add a generation step for the username’s variable and it will be unique in every step.

Example:

> import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint  
> import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase  
> import static com.kms.katalon.core.testdata.TestDataFactory.findTestData  
> import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject  
> import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint  
> import com.kms.katalon.core.checkpoint.CheckpointFactory as CheckpointFactory  
> import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as MobileBuiltInKeywords  
> import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile  
> import com.kms.katalon.core.model.FailureHandling as FailureHandling  
> import com.kms.katalon.core.testcase.TestCase as TestCase  
> import com.kms.katalon.core.testcase.TestCaseFactory as TestCaseFactory  
> import com.kms.katalon.core.testdata.TestData as TestData  
> import com.kms.katalon.core.testdata.TestDataFactory as TestDataFactory  
> import com.kms.katalon.core.testobject.ObjectRepository as ObjectRepository  
> import com.kms.katalon.core.testobject.TestObject as TestObject  
> import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WSBuiltInKeywords  
> import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS  
> import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUiBuiltInKeywords  
> import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI  
> import internal.GlobalVariable as GlobalVariable  
> import org.apache.commons.lang.RandomStringUtils
> 
> ‘Max length of generated string’  
> randomStringLength = 5
> 
> String charset = ((‘a’…‘z’) + (‘A’…‘Z’) + (‘0’…‘9’)).join()  
> String randomString = RandomStringUtils.random(randomStringLength, charset.toCharArray())  
> userName = userName + randomString
> 
> WebUI.openBrowser(GlobalVariable.G\_SiteURL)  
> WebUI.setText(findTestObject(‘Page\_Login/txt\_UserName’), Username)  
> WebUI.closeBrowser()

P/s: In the further case that you need to execute test suite on multiple dataset, it’s best to use data-driven feature of the test suite:

[https://docs.katalon.com/display/KD/Data+for+Test+Execution](https://docs.katalon.com/display/KD/Data+for+Test+Execution)
