# How can I increment 1 value in an email address for uniqueness

**URL:** <https://forum.katalon.com/t/how-can-i-increment-1-value-in-an-email-address-for-uniqueness/6621>\
**Category:** Web Testing\
**Tags:** katalon-studio\
**Created:** [September 28, 2017, 1:24pm UTC](https://forum.katalon.com/t/how-can-i-increment-1-value-in-an-email-address-for-uniqueness/6621 "2017-09-28T13:24:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![michelle\_roberts](https://avatars.discourse-cdn.com/v4/letter/m/c68b51/32.png) [@michelle\_roberts](https://forum.katalon.com/u/michelle_roberts)\
**Post date:** [September 28, 2017, 1:24pm UTC](https://forum.katalon.com/t/how-can-i-increment-1-value-in-an-email-address-for-uniqueness/6621/1 "2017-09-28T13:24:32Z")

</div>

I am writing test script for signup page and I need to put in a unique email address each time. Can someone help me with how to increment by value 1 in the email address as I execute the script for example, [test@test.com](mailto:test@test.com) and next time value should be [test1@test.com](mailto:test1@test.com). I tried something and it was adding the unique string to the end of the email address - I need to add it to the beginngin before the “@”.

---

<div class="post-metadata">

**Author:** ![Marek\_Melocik](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/marek_melocik/32/371_2.png) [@Marek\_Melocik](https://forum.katalon.com/u/Marek_Melocik)\
**Post date:** [October 2, 2017, 8:01am UTC](https://forum.katalon.com/t/how-can-i-increment-1-value-in-an-email-address-for-uniqueness/6621/2 "2017-10-02T08:01:48Z")

</div>

Why you don’t use timestamp as an username?

```
String ts = System.currentTimeMillis().toString()
WebUI.setText(findTestObject("your/login/field"), ts + "@test.com")
```

---

<div class="post-metadata">

**Author:** ![chithram](https://avatars.discourse-cdn.com/v4/letter/c/a3d4f5/32.png) [@chithram](https://forum.katalon.com/u/chithram)\
**Post date:** [July 3, 2019, 7:29am UTC](https://forum.katalon.com/t/how-can-i-increment-1-value-in-an-email-address-for-uniqueness/6621/3 "2019-07-03T07:29:28Z")

</div>

Hello can you please tell me how can i add this condition inside test case

---

<div class="post-metadata">

**Author:** ![Marek\_Melocik](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/marek_melocik/32/371_2.png) [@Marek\_Melocik](https://forum.katalon.com/u/Marek_Melocik)\
**Post date:** [July 3, 2019, 7:32am UTC](https://forum.katalon.com/t/how-can-i-increment-1-value-in-an-email-address-for-uniqueness/6621/4 "2019-07-03T07:32:07Z")

</div>

Open a script mode in your test case and put the code there.

---

<div class="post-metadata">

**Author:** ![chithram](https://avatars.discourse-cdn.com/v4/letter/c/a3d4f5/32.png) [@chithram](https://forum.katalon.com/u/chithram)\
**Post date:** [July 3, 2019, 10:06am UTC](https://forum.katalon.com/t/how-can-i-increment-1-value-in-an-email-address-for-uniqueness/6621/5 "2019-07-03T10:06:57Z")

</div>

Thanks that worked 👍  
I need one more info,can we check in database if that value exists or not  
for ex: check whether entered name like “Test10” exists in db or not.if exists then increment it by 1 like “Test11”  
Thanks in advance.
