Can any know how to use assertion in katalon for validation purpose even our script should run if there is failed validation…
I believe this is what the FailureHandling argument is for:
If you want your script to continue on failure, use FailureHandling.CONTINUE_ON_FAILURE
As @Brandon_Hein says above, you can use the FailureHandling argument, however, you can also use other statements to “verify” that the contents of a textbox, or textarea, is “correct”, or the chosen drop-down is the “correct” choice, etc… As an example:
For textbox or textarea:
WebUI.setText(findTestObject('Gender'), "He/Him") WebUI.verifyElementAttributeValue(findTestObject('Gender'), "value", "He/Him", 10)
WebUI.selectOptionByLabel(findTestObject('Gender'), "She/Her", false) WebUI.verifyOptionSelectedByLabel(findTestObject('Gender'), "She/Her", false, 10)
There are other verify statements that can help your validation purpose.
The assumption I make is you have your Default FailureHandling setting at OPTIONAL, which is the out-of-the-box setting. If you have changed the default setting, then you will need to add the appropriate FailureHandling option on every statement.
Putting it all together, the “assertion” part of the soft assert is as @grylion54 says, it’s all of the “verify” keywords in Katalon. The “soft” part of the soft assert is the FailureHandling. So if you wanted to assert that an element was present on the page within 10 seconds, but not fail the test if it wasn’t, you’d do this:
WebUI.verifyElementPresent(findTestObject('path/to/object'), 10, FailureHandling.CONTINUE_ON_FAILURE)
Or change the default value in the studio settings.