Frameworks 使用SQL运行关键字If
我试图从Restful web服务中提取数据 如果我得到一个包含单词a的文本值,那么我需要运行这个SQL来验证,如果没有,则运行另一个SQL 如果要运行关键字,但查询语句以变量开头,则使用该run关键字 这就是我尝试过的:Frameworks 使用SQL运行关键字If,frameworks,robotframework,Frameworks,Robotframework,我试图从Restful web服务中提取数据 如果我得到一个包含单词a的文本值,那么我需要运行这个SQL来验证,如果没有,则运行另一个SQL 如果要运行关键字,但查询语句以变量开头,则使用该run关键字 这就是我尝试过的: ${typeA} Set Variable ${rowValues["TypeA"]} ${foundValue} Get Lines Containing String ${typeA} Speical ${lineCount} Get Line
${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.
运行关键字if
中条件后的第一个参数必须是关键字。您错误地给了它一个变量(根据您报告的错误,该变量可能包含字符串“test”)
要分配查询的值,必须捕获运行关键字的结果,如果:
${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;