I am a complete beginner when it comes to robot framework, my apologies if this is a silly question.
So I have a user defined keyword here:
GET call to an API
[Arguments] ${user_uuid} ${country_uuid} ${http_status_code}
${json_date_uuid} = Set Variable $.date
#code here#
${response} = Trigger GET ${HTTP_SERVER} ${APP_UUID} ${PRI_KEY} ${get_endpoint} ${secs_headers} ${no_query_param}
Log Endpoint GET Result:
Log ${response.status_code}
Log ${response.content}
Now I am trying to do a validation to check the response.status_code
to see if it is returning 200 or 404.
If it is 200, I want it to run the following steps:
Should Be Equal As Strings ${response.status_code} ${status_code}
${milestone_definition} = Retrieve Json Value ${response.content} ${json_date_uuid}
List Should Contain Value ${value} 12345
If it is 404, I want it to run the following:
Should Be Equal As Strings ${response.status_code} ${status_code}
So I have tried the following where I defined the steps as keywords under the GET call to an API keyword and call them using IF/ELSE IF but to no avail:
GET call to an API
[Arguments] ${user_uuid} ${country_uuid} ${http_status_code}
${json_date_uuid} = Set Variable $.date
#code here#
${response} = Trigger GET ${HTTP_SERVER} ${APP_UUID} ${PRI_KEY} ${get_endpoint}
${secs_headers} ${no_query_param}
Log Endpoint GET Result:
Log ${response.status_code}
Log ${response.content}
Run Keyword If ${response.status_code} == 200 GET SEC Success Validation ELSE IF ${response.status_code} == 404 GET SEC Failure Validation
#Validation
GET SEC Success Validation
Should Be Equal As Strings ${response.status_code} ${status_code}
${milestone_definition} = Retrieve Json Value ${response.content} ${json_date_uuid}
List Should Contain Value ${value} 12345
GET SEC Failure Validation GET
Should Be Equal As Strings ${response.status_code} ${status_code}
Unfortunately it returns the following error when I run the command:
Keyword 'API_Keywords.GET SEC Success Validation' expected 0 arguments, got 2.
Any tips or guidances on how I can achieve this please?