Hello,
This may be an odd situation/request I’m trying to figure out here. I have a while statement that loops through and adds records until an allotment is met and then continues on to other things. Is there a way to make it so the while statement does not show as failed in the reports/logs?
The while statement of course is designed to fail but technically this is not a failed test as I’m trying to just fill the allotment and then continue. I would use a for statement but the allotment number is not always the same.
I have tried various ways of failure handling but I haven’t made any discoveries on it. My first assumption is that this cannot be done since a while statement will always fail (unless you have an infinite loop).
I’ll post my sample while statement code below:
while (exhibitor_reg == true) {
if(reg_number == 5){
break
}
try {
WebUI.verifyElementPresent(findTestObject('IECS0618 EX Objects/input_btnAddEditEX'), 1, FailureHandling.OPTIONAL)
WebUI.click(findTestObject('IECS0618 EX Objects/input_btnAddEditEX'))
WebUI.delay(1)
WebUI.click(findTestObject('IECS0618 EX Objects/input_btnContinue'))
if (WebUI.verifyElementPresent(findTestObject('IECS0618 EX Objects/div_You missed 4 field(s). The'), 0)) {
WebUI.comment('Validation is working')
} else {
WebUI.comment('Validation has failed')
return null
}
WebUI.setText(findTestObject('IECS0618 EX Objects/input_FirstName'), 'testrecord')
WebUI.setText(findTestObject('IECS0618 EX Objects/input_LastName'), 'testrecord')
WebUI.setText(findTestObject('IECS0618 EX Objects/input_Phone'), '9876543210')
WebUI.setText(findTestObject('IECS0618 EX Objects/input_Email'), 'testrecord@cdsreg.com')
WebUI.click(findTestObject('IECS0618 EX Objects/input_btnContinue'))
reg_number++
}
catch (Exception e) {
//exhibitor_reg = false
break
}
}
Any info or help on this is much appreciated,