I’m guessing that I’m not understanding something about failure logging here.
Both the “if’s” in Scenario A verify the same thing, and both result in failures. The Log Viewer displays both of them correctly as failures with the correct message logs, but those failures do not show up in the Test Cases Table / Test Case’s Log. But in Scenario B (also failures), the results show in both the Log Viewerand the Test Cases Table / Test Case’s Log. Am I missing something from Scenario A to get the failures to show in the Test Case’s Log?
Scenario A:
KeywordLogger log = new KeywordLogger()
if (WebUI.verifyElementAttributeValue(findTestObject('Page_eForms/select_TransportationTypeDropDown'), 'class', GlobalVariable.requiredFieldClassValue, GlobalVariable.ShortWaitTime, FailureHandling.CONTINUE_ON_FAILURE)) {
log.logFailed('Type is supposed to be a required field')
}
if (WebUI.verifyElementAttributeValue(findTestObject('Page_eForms/select_TransportationTypeDropDown'), 'class', GlobalVariable.requiredFieldClassValue, GlobalVariable.ShortWaitTime, FailureHandling.CONTINUE_ON_FAILURE)) {
KeywordUtil.markFailed('Type is supposed to be a required field')
}
Scenario B:
if (!(WebUI.verifyTextPresent(textArrivalCity, false, FailureHandling.OPTIONAL))) {
KeywordUtil.markFailed('onSave Arrival City validation message is missing')
}
if (!(WebUI.verifyTextPresent(textDepartureCity, false, FailureHandling.OPTIONAL))) {
KeywordUtil.markFailed('onSave Departure City validation message is missing')
}
I thought that might be it, too. Though when I switch Scenario A over to FailureHandling.OPTIONAL, the results for #28 and #29 are still logged in the Log Viewer but not in the Test Case’s Log.
I’ve been using KeywordUtil.markFailed('message'). The original example had the KeywordLogger and log.logFailed('message') just to try it out and see what happened.
I’d like the test to continue even if a check fails, though wanted to try your suggestion of stopping the test on a failure. When I change it to the code below, #28 shows in the Test Case’s Log, but it doesn’t put my markFailedAndStop message anywhere (and the test continues without stopping, guessing because of FailureHandling.CONTINUE_ON_FAILURE)
if (WebUI.verifyElementAttributeValue(findTestObject('Page_eForms/select_TransportationTypeDropDown'), 'class', GlobalVariable.normalFieldClassValue, GlobalVariable.ShortWaitTime, FailureHandling.CONTINUE_ON_FAILURE)) {
KeywordUtil.markFailedAndStop('Transportation Type is supposed to be a required field')
}