我正在尝试从 Restful Web 服务中提取数据。
如果我得到一个包含单词 A 的文本值,那么我需要运行此 SQL 来验证,如果没有,请运行不同的 SQL。
此运行关键字 If 想要运行关键字,但 Query 语句以变量开头。
这是我尝试过的:
${typeA} Set Variable ${rowValues["TypeA"]}
${foundValue} Get Lines Containing String ${typeA} Speical
${lineCount} Get Line Count ${foundValue}
${resultValue} Set Variable If ${lineCount} > 0 ${True} ${False}
${idvalue} Set Variable test
Run Keyword If ${resultValue}
... ${idvalue} Query Select max(id) from test where 1 =1;
... ELSE
... ${idValue} Query Select max(id) from table 2 where 1 = 1;
我只是收到此错误:
FAIL : No keyword with name 'test' found.
Run keyword if
中条件后的第一个参数必须是关键字。您错误地为其提供了一个变量(根据您报告的错误,该变量可能包含字符串"test"(
要分配查询的值,您必须捕获Run keyword if
的结果:
${idValue}= Run keyword if ${resultValue}
... Query Select max(id) from test where 1 =1;
... ELSE
... Query Select max(id) from table 2 where i = 1;