我在Python的Robot框架中使用以下代码
*** Settings ***
Library SeleniumLibrary
Test Template Create New Guest of Specified Type
*** Test Cases ***
Verify creation of new guest of type Today
guest_details = &{TodayGuestDetails} schedule_type = Today guest_type = Visitor
*** Keywords ***
Create New Guest of Specified Type
[Arguments] ${guest_details}=guest_details ${schedule_type}=schedule_type ${guest_type}=guest_type
Fill Guest Details ${guest_details}
*** Variables ***
&{TodayGuestDetails} firstname=Test lastname=Guest [email protected]
上面的代码有什么问题?我收到错误
Resolving variable '${guest_details = {'firstname': 'Test', 'lastname': 'Guest', 'email': '[email protected]'}}' failed: Variable '${guest_details }' not found.
guest_details 被存储在字典中,所以我必须这样做
*** Test Cases ***
Verify creation of new guest of type Today
schedule_type = Today guest_type = Visitor guest_details = &{TodayGuestDetails}
*** Keywords ***
Create New Guest of Specified Type
[Arguments] ${schedule_type} ${guest_type} &{dict}
Set Suite Variable ${guest_details} ${dict["guest_details"]}
Fill Guest Details ${guest_details}