Return results in Robot Framework keyword?

前端 未结 5 1398
青春惊慌失措
青春惊慌失措 2021-02-05 08:34

How can I return the results after running a keyword?

Example:

mykey word [Arguments] input
   ${results}=  getme input

But I want to u

5条回答
  •  时光说笑
    2021-02-05 09:16

    A simple example may help:

    *** Keywords ***
    Convert temperature F To Centigrade
      [Arguments]  ${ftemp}
      ${ftemp} =  Convert To Float  ${ftemp}
      ${ctemp} =  ${0.9} * ${ftemp} - ${32}
      [Return]  ${ctemp}
    
    Convert temperature C To Fahrenheit
      [Arguments]  ${ctemp}
      ${ctemp} =  Convert To Float  ${ctemp}
      ${ftemp} =  ${1.8} * ${ctemp} + ${32}
      [Return]  ${ftemp}
    
    *** Test Cases ***
    Verify Temperature Conversion  
      ${result} =  Convert temperature F To Centigrade  ${32}
      Should Be Equal  ${result}  ${0}
      ${result} =  Convert temperature C To Fahrenheit  ${0}
      Should Be Equal  ${result}  ${32}
    

提交回复
热议问题