How to handle data duplications in Katalon using data driven through Excel

Unless any field has a specific format, how about just adding a datetimestamp onto the end of each of your entries that cause duplicate errors? Or perhaps, you can add a row number to your spreadsheet and include the row number for each value.

import java.time.LocalDate
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter

DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyyMMdd HH:mm");

LocalDateTime localDate = LocalDateTime.now()

glocalDate = localDate.format(dateFormat).replace(':','').replace(' ','')

WebUI.verifyElementClickable(findTestObject('myPage/input_firstName'))
WebUI.setText(findTestObject('myPage/input_firstName'), findTestData('...').getValue('UserName', 1) + glocalDate)
WebUI.verifyElementAttributeValue(findTestObject('myPage/input_firstName'), "value", findTestData('...').getValue('UserName', 1) + glocalDate, 10)

If your field has a specific format, then how about just creating random numbers (Strings) and then adjusting them to your format within a Keyword, or in-line functions, and not from your Excel for these fields:

1 Like