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

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 and next time value should be 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 “@”.

Why you don’t use timestamp as an username?

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

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

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

Thanks that worked :+1:
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.