'Should contain' keyword help needed

Hi All,

I’m a new user to Robot Framework (v3) and I’ve come across some unexpected behaviour (to me anyway) with the “Should Contain” keyword in the builtin library while using Renode.
My robot script simply checks if a received UART line contains an expected string. I want the lines following the ‘Should Contain’ to be executed regardless if it passes or fails, but they only get executed if the test passes. Given that there’s no indentation possible here, I’m wondering how I implement the required logic here ?

Target should return “${expected_string}” on UART
${uart_data}= Wait For Next Line On Uart
Should Contain ${uart_data.line} ${expected_string} # next lines only execute on Pass, why ???
${uart_data}= Wait For Next Line On Uart
Log ${uart_data}
Should Contain ${uart_data.line} ${EMPTY}

Because you are testing a condition with Should. If the test fails there then there is no sense in continuing testing.

What you can do is to use Run Keyword and Continue on Failure Should ....

1 Like

thanks for the reply,

In this context I was using ‘Should’ as part of a sub routine used by any test to verify if a UART string is correct or not. I haven’t found this behaviour documented as part of the ‘Should’ instruction. This is why I find it unusual and unexpected but thank you for noting an alternative.

I will try the way you advised instead.

Many thanks !