Check if a line contains a sentence and generate error if next line contain other sentence in logs file

I am new to using this framework.

I have a log file that may contain errors.

However, if a line contains the keyword “ERROR” then the following line the sentence “No provisioning file found”, the error should not make the test fail, example :

...
2021-06-03 07:51:22,487|ERROR|http-listener-1
Message : No provisioning file found
...

Here we have an ERROR but followed by “Message : No provisioning file found” on the next line so it should not make the Test fail.

I wrote this:

Checking errors in logs

|{logs}=|Get File|${path}
|@{logLines}=|Split to lines|${logs}
||:FOR|${line}|IN|@{logLines}
      ?????
||END

But I don’t know how to do the body of the loop because I have to go through the lines in pairs.

Hi Leloup,

probably the simplest way would be before the for loop set a variable to 1 e.g.
${next}= set variable 1
then add 1 to that variable as the last line of the for loop (before END), then in your for loop if ${line} contains ERROR, then @{logLines}[${next}] would contain the next line so you can pass it to any keyword you need.

Hope that’s what you wanted,

Dave.