saurabh baid
saurabh baid

Reputation: 1877

Robot Framework Regular Expression with Dot All

I am not able to figure out how to do re.DOTALL equivalent in robot framework Why the below regex is not matching?

'(?s).*Total Test Cases executed.*' does not match '
Sleep for 10 sec

 Total Test Cases executed :  1
 Total Test Cases Passed   :  1
 Total Test Cases Failed   :  0
 Total Test Cases Aborted  :  0'

Upvotes: 0

Views: 597

Answers (1)

Todor Minakov
Todor Minakov

Reputation: 20067

Your syntax looks ok, and it works for me:

${test}=   Catenate    SEPARATOR=\n
...     Sleep for 10 sec

...     Total Test Cases executed: 1
...     Total Test Cases Passed:1
...     Total Test Cases Failed: 0
...     Total Test Cases Aborted: 0

Should Match Regexp     ${test}     (?s).*Total Test Cases executed.*
${matches}=     Get Regexp Matches   ${test}     (?s).*Total Test Cases executed.*

Both Should Match Regexp and Get Regexp Matches successfully find the line.

Looking at your error though, please check how you are calling the keywords - the first argument should be the string, and the 2nd the pattern.
(when the regexp doesn't match anything, the output is 'string' does not match 'pattern', it looks reversed in your error)

Upvotes: 1

Related Questions