参数规范无效:varargs之后的位置参数

时间:2016-11-02 07:39:31

标签: robotframework

我正在尝试将2个标量和2个列表变量传递给用户关键字,但我得到了“无效的参数规范:varargs之后的位置参数”。是不是可以将多个列表变量传递给用户关键字?

我正在努力:

*** Test Cases ***
Sample Case
    Personal Details Page Fill Form    ${firstName}    ${surname}    @{dateofbirth}  @{nextsalarydate}

    *** Keywords ***
Personal Details Page Fill Form
    [Arguments]    ${firstName}    ${surname}    @{dateofbirth}  @{nextsalarydate} 
    Input Text    id = firstName    ${firstName}
    Input Text    id = lastName    ${surname}
    Personal Details Page Select Date of Birth    ${dateofbirth[0]}    ${dateofbirth[1]}    ${dateofbirth[2]}
    Personal Details Page Select Next Salary Date    ${nextsalarydate[0]}    ${nextsalarydate[1]}    ${nextsalarydate[2]}

1 个答案:

答案 0 :(得分:6)

当您将多个列表变量传递给用户关键字时,您应该使用'$'作为列表而不是'@'。请尝试以下方法:

*** Test Cases ***
Sample Case
     Personal Details Page Fill Form    ${firstName}    ${surname}    ${dateofbirth}  ${nextsalarydate}

*** Keywords ***
Personal Details Page Fill Form
    [Arguments]    ${firstName}    ${surname}    ${dateofbirth}  ${nextsalarydate} 
    Input Text    id = firstName    ${firstName}
    Input Text    id = lastName    ${surname}
    Personal Details Page Select Date of Birth    ${dateofbirth[0]}    ${dateofbirth[1]}    ${dateofbirth[2]}
    Personal Details Page Select Next Salary Date    ${nextsalarydate[0]}    ${nextsalarydate[1]}    ${nextsalarydate[2]}