I have some validation points in my test case. The test case execution should not stop even if the validation parts are getting failed it should log failure message and continue with remaining script
*** Test Cases ***
Validating Dropdown
${sums}= ['1234','455','4689','9837']
${sum2}= ['1234','455','46','9837']
${sum_count}= Get Length ${sums}
FOR ${i} IN RANGE ${sum_count}
${sums}[${i}]==${sum2}[${i}]
END
${sums3}= ['12','455','4689','9837']
${sum4}= ['34','455','46','9837']
${sum_count1}= Get Length ${sums3}
FOR ${i} IN RANGE ${sum_count}
${sums3}[${i}]==${sum4}[${i}]
END
${sums5}= ['1234','455','4689','9837']
${sum6}= ['1234','455','4689','9837']
${sum_count2}= Get Length ${sums5}
FOR ${i} IN RANGE ${sum_count}
${sums5}[${i}]==${sum6}[${i}]
END
The entire script will run in for loop it should not stop even if the particular validation fails it should continue with the script and log result of each validation whether it is failed or passed
The entire script will run in for loop it should not stop execution even if the particular validation fails it should continue with the script and log result of each validation whether it is failed or passed in Robot Framrwork
You test is failing due to syntax error. This is the error:
========================================================================================
Validating Dropdown | FAIL |
No keyword with name '${sums}= ['1234','455','4689','9837']' found.
----------------------------------------------------------------------------------------
Validate Continue | FAIL |
1 test, 0 passed, 1 failed
=======================================================================================
And inside each loop you are not calling a keyword. It will also fail.
This should be a possible corrected test case:
*** Settings ***
Library Collections
*** Test Cases ***
Validating Dropdown
${collector}= Create List
Set Test Variable \${collector}
${sums}= Create List '1234' '455' '4689' '9837'
${sum2}= Create List '1234' '455' '46' '9837'
${sum_count}= Get Length ${sums}
FOR ${i} IN RANGE ${sum_count}
${result}= Run Keyword And Continue On Failure Validate Equal ${sums}[${i}] ${sum2}[${i}]
Run Keyword If "${result[0]}" == "FAIL" Append To List ${collector} ${result}
END
# Report
${sums3}= Create List '12' '455' '4689' '9837'
${sum4}= Create List '34' '455' '46' '9837'
${sum_count1}= Get Length ${sums3}
FOR ${i} IN RANGE ${sum_count1}
${result}= Run Keyword And Continue On Failure Validate Equal ${sums3}[${i}] ${sum4}[${i}]
Run Keyword If "${result[0]}" == "FAIL" Append To List ${collector} ${result}
END
# Report
${sums5}= Create List '1234' '455' '4689' '9837'
${sum6}= Create List '1234' '455' '4689' '9837'
${sum_count2}= Get Length ${sums5}
FOR ${i} IN RANGE ${sum_count2}
${result}= Run Keyword And Continue On Failure Validate Equal ${sums3}[${i}] ${sum4}[${i}]
Run Keyword If "${result[0]}" == "FAIL" Append To List ${collector} ${result}
END
Report
*** Keywords ***
Validate Equal
[Arguments] ${arg1} ${arg2}
${result}= Run Keyword And Ignore Error Should Be Equal ${arg1} ${arg2}
RETURN ${result}
Report
${fail_count}= Get Length ${collector}
IF ${fail_count} > 0
Log Many @{collector}
Fail Validation of elements failed. Some are different
END