我想在不断更新的文件中查找特定邮件。我使用 Wait Until Keyword Succeeds 和我自己的关键字来搜索文件,它运行正常。
*** Test Cases ***
${lineCount} MyKeywordToGetLineCountToStartSearch ${filename}
Wait Until Keyword Succeeds 10s 2s KeywordToLookForTheMessage ${filename} ${linecount} ${message}
*** Keywords ***
KeywordToLookForTheMessage
[Arguments] ${filename} ${linecount} ${message}
Run tail -n +${linecount} ${filename} > ${locationdir}/${newfile}
${filecontent} Get File ${locationdir}/${newfile}
@{lines} Split To Lines ${filecontent}
${result_list} Create List
: FOR ${line} IN @{lines}
\ ${state} ${msg} Run Keyword And Ignore Error Should Contain ${line} ${message}
\ Run Keyword If '${state}' == 'PASS' Append To List ${result_list} ${line}
Should not be empty ${result_list}
现在我缺少的是,
我该怎么做?
答案 0 :(得分:1)
这种复杂的逻辑应该使用Python在测试库中实现,而不是尝试使用现有库提供的低级关键字。