Best way to pass multiple parameter to methods in robot framework

Hi

I have one common method in my robot script
Get Source and Send to DB
[Arguments] ${api_url} ${id} ${page_name1} ${page_name2} ${page_name4} ${page_name5} ${page_name6} ${page_name7} ${page_name8} ${page_name9}

Whenever I have call common method

Get Source and Send to DB 1 2 3 4 5 6 7 8 9

I have to pass all these parameter all the time. Is there any best way to pass that in single object and refer
I want to understand all the best approaches

Hello,

You can use this magic trick : ).

    Run Magic Keyword
        [Arguments]    ${KW}    @{KWARGS}
        (Do Something)

EX Use:

Run Magic Keyword 1 2 3 4 5 6 7 8 9

=> Use this way, you can pass as many as you want args to this keyword.

Cheers,

@SimoneTrinh

How to read values from @{KWARGS} and ${KW} inside that method

I want to log values

What is first parameter ${KW} …how many values we can pass and fetch
what is second parameter @{KWARGS}…how many values we can pass in that and how to fetch

I have used like below
Run Magic Keyword
[Arguments] ${KW} @{KWARGS}
Log ${KW}
Log ${KWARGS}
Log @{KWARGS}
:FOR ${arg} IN @{kwargs}
${key} ${value}= Evaluate “${arg}”.split(“=”)
Log ${key}, ${value}

I am getting undefined keyword FOR

I also tried above code -Getting error saying unexpected arguments

@SimoneTrinh

Below is code-