Test Failures Display in Log Viewer but not in Test Case's Log

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 Viewer and 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')
}

kindly repost the code part using code formatting. without indentation is almost unreadable

Can you give us a screenshot ? What does the Test Case Log looks like, as compared to the Log Viewer ?

Both of the code snippets are from Test Case 4. #108 and #111 show in the upper-right log, but #28 and #29 don’t.

You’re using

  1. Scenario A: FailureHandling.CONTINUE_ON_FAILURE

  2. Scenario B: FailureHandling.OPTIONAL

clue?

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.

Okay, I’ll duck out then - was just a stab in the dark.

Wait… are you using markFailed consistently?

And what about or markFailedAndStop and/or throw - are you averse to stopping the test at that point?

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')
}

Sorry, I’ll have to hand you back to @ThanhTo – this is not something I’m very familiar with.