How can i add an optional list parameter to my keyword at robotframework?Select option robotframeworkHow can we use “Set Variable if” with a keyword where Keyword is returning a variable RobotFrameworkHow to use User Keyword Arguments with default values in RobotFrameworkRobotframework: How to build proper keyword with embedded variable which defines number next parameters?RobotFramework Keyword variable not settingRobotFramework: Define a Python keyword in RobotFrameworkhow to list all keywords used by a robotframework test suiteHow to handle a named parameter and @keyword in robotframeworkHow to add additional output info from code to robotframework *.html reportRobotFramework - How to Return Value from Keyword and Stop?
How would you write do the dialogues of two characters talking in a chat room?
Can a continent naturally split into two distant parts within a week?
How did John Lennon tune his guitar
Is it okay to retroactively change things when running a published adventure?
Why do legislative committees exist?
Deep Learning based time series forecasting
Why is dry soil hydrophobic? Bad gardener paradox
How to fit a linear model in the Bayesian way in Mathematica?
Crab Nebula short story from 1960s or '70s
Behavior of the zero and negative/sign flags on classic instruction sets
Why linear regression uses "vertical" distance to the best-fit-line, instead of actual distance?
How are "soeben" and "eben" different from one another?
Ezek. 24:1-2, "Again in the ninth year, in the tenth month, in the tenth day of the month, ...." Which month was the tenth month?
Would letting a multiclass character rebuild their character to be single-classed be game-breaking?
What are some symbols representing peasants/oppressed persons fighting back?
What impact would a dragon the size of Asia have on the environment?
GPIO and Python - GPIO.output() not working
Does optical correction give a more aesthetic look to the SBI logo?
Why doesn't Anakin's lightsaber explode when it's chopped in half on Geonosis?
Are there any double stars that I can actually see orbit each other?
Cubic programming and beyond?
Remove intersect line for one circle using venndiagram2sets
Is killing off one of my queer characters homophobic?
What are the arguments for California’s nonpartisan blanket primaries other than giving Democrats more power?
How can i add an optional list parameter to my keyword at robotframework?
Select option robotframeworkHow can we use “Set Variable if” with a keyword where Keyword is returning a variable RobotFrameworkHow to use User Keyword Arguments with default values in RobotFrameworkRobotframework: How to build proper keyword with embedded variable which defines number next parameters?RobotFramework Keyword variable not settingRobotFramework: Define a Python keyword in RobotFrameworkhow to list all keywords used by a robotframework test suiteHow to handle a named parameter and @keyword in robotframeworkHow to add additional output info from code to robotframework *.html reportRobotFramework - How to Return Value from Keyword and Stop?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am trying to add optional dictionary and list to my keyword, how can assign their default values?
robotframework
add a comment |
I am trying to add optional dictionary and list to my keyword, how can assign their default values?
robotframework
Can you explain what you've tried and what the error is that you're seeing?
– A. Kootstra
Mar 26 at 7:47
Are you writing this keyword in robot, in python, or some other language? It would help if you could provide a minimal reproducible example that shows us what you've tried.
– Bryan Oakley
Mar 26 at 13:05
add a comment |
I am trying to add optional dictionary and list to my keyword, how can assign their default values?
robotframework
I am trying to add optional dictionary and list to my keyword, how can assign their default values?
robotframework
robotframework
asked Mar 26 at 6:39


Alper OguzkanAlper Oguzkan
193 bronze badges
193 bronze badges
Can you explain what you've tried and what the error is that you're seeing?
– A. Kootstra
Mar 26 at 7:47
Are you writing this keyword in robot, in python, or some other language? It would help if you could provide a minimal reproducible example that shows us what you've tried.
– Bryan Oakley
Mar 26 at 13:05
add a comment |
Can you explain what you've tried and what the error is that you're seeing?
– A. Kootstra
Mar 26 at 7:47
Are you writing this keyword in robot, in python, or some other language? It would help if you could provide a minimal reproducible example that shows us what you've tried.
– Bryan Oakley
Mar 26 at 13:05
Can you explain what you've tried and what the error is that you're seeing?
– A. Kootstra
Mar 26 at 7:47
Can you explain what you've tried and what the error is that you're seeing?
– A. Kootstra
Mar 26 at 7:47
Are you writing this keyword in robot, in python, or some other language? It would help if you could provide a minimal reproducible example that shows us what you've tried.
– Bryan Oakley
Mar 26 at 13:05
Are you writing this keyword in robot, in python, or some other language? It would help if you could provide a minimal reproducible example that shows us what you've tried.
– Bryan Oakley
Mar 26 at 13:05
add a comment |
2 Answers
2
active
oldest
votes
In the RF User Guide you can find examples of how you can add arguments with default values. In short, after the variable you have to add "=" and the value by default. Here is an example:
One Required And One With Default
[Arguments] $required $optional=default
[Documentation] This keyword takes 1-2 arguments
Log Required: $required
Log Optional: $optional
add a comment |
While the other answer covers correctly keyword parameters with defeat values, your question is for a default list one.
And this is not allowed by Robot Framework syntax (and in python, having a default value being a predefined list is a source of a lot of pain and hidden bugs :). So the solution for that is to have a parameter which default value is None
(usually, really anything the caller would not pass would do), and check was it set in the call; if not - assign it to the default list, inside the keyword:
My Keyword That Accepts Optional List
[Arguments] $the_list=$None
$the default value= Create List member0 the other one
$the_list= Set Variable If $the_list is None $the default value # no argument passed when the keyword was called
... $the_list # an argument was passed, leave the variable as it was
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55351148%2fhow-can-i-add-an-optional-list-parameter-to-my-keyword-at-robotframework%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
In the RF User Guide you can find examples of how you can add arguments with default values. In short, after the variable you have to add "=" and the value by default. Here is an example:
One Required And One With Default
[Arguments] $required $optional=default
[Documentation] This keyword takes 1-2 arguments
Log Required: $required
Log Optional: $optional
add a comment |
In the RF User Guide you can find examples of how you can add arguments with default values. In short, after the variable you have to add "=" and the value by default. Here is an example:
One Required And One With Default
[Arguments] $required $optional=default
[Documentation] This keyword takes 1-2 arguments
Log Required: $required
Log Optional: $optional
add a comment |
In the RF User Guide you can find examples of how you can add arguments with default values. In short, after the variable you have to add "=" and the value by default. Here is an example:
One Required And One With Default
[Arguments] $required $optional=default
[Documentation] This keyword takes 1-2 arguments
Log Required: $required
Log Optional: $optional
In the RF User Guide you can find examples of how you can add arguments with default values. In short, after the variable you have to add "=" and the value by default. Here is an example:
One Required And One With Default
[Arguments] $required $optional=default
[Documentation] This keyword takes 1-2 arguments
Log Required: $required
Log Optional: $optional
answered Mar 26 at 7:50
NomceNomce
5901 gold badge4 silver badges16 bronze badges
5901 gold badge4 silver badges16 bronze badges
add a comment |
add a comment |
While the other answer covers correctly keyword parameters with defeat values, your question is for a default list one.
And this is not allowed by Robot Framework syntax (and in python, having a default value being a predefined list is a source of a lot of pain and hidden bugs :). So the solution for that is to have a parameter which default value is None
(usually, really anything the caller would not pass would do), and check was it set in the call; if not - assign it to the default list, inside the keyword:
My Keyword That Accepts Optional List
[Arguments] $the_list=$None
$the default value= Create List member0 the other one
$the_list= Set Variable If $the_list is None $the default value # no argument passed when the keyword was called
... $the_list # an argument was passed, leave the variable as it was
add a comment |
While the other answer covers correctly keyword parameters with defeat values, your question is for a default list one.
And this is not allowed by Robot Framework syntax (and in python, having a default value being a predefined list is a source of a lot of pain and hidden bugs :). So the solution for that is to have a parameter which default value is None
(usually, really anything the caller would not pass would do), and check was it set in the call; if not - assign it to the default list, inside the keyword:
My Keyword That Accepts Optional List
[Arguments] $the_list=$None
$the default value= Create List member0 the other one
$the_list= Set Variable If $the_list is None $the default value # no argument passed when the keyword was called
... $the_list # an argument was passed, leave the variable as it was
add a comment |
While the other answer covers correctly keyword parameters with defeat values, your question is for a default list one.
And this is not allowed by Robot Framework syntax (and in python, having a default value being a predefined list is a source of a lot of pain and hidden bugs :). So the solution for that is to have a parameter which default value is None
(usually, really anything the caller would not pass would do), and check was it set in the call; if not - assign it to the default list, inside the keyword:
My Keyword That Accepts Optional List
[Arguments] $the_list=$None
$the default value= Create List member0 the other one
$the_list= Set Variable If $the_list is None $the default value # no argument passed when the keyword was called
... $the_list # an argument was passed, leave the variable as it was
While the other answer covers correctly keyword parameters with defeat values, your question is for a default list one.
And this is not allowed by Robot Framework syntax (and in python, having a default value being a predefined list is a source of a lot of pain and hidden bugs :). So the solution for that is to have a parameter which default value is None
(usually, really anything the caller would not pass would do), and check was it set in the call; if not - assign it to the default list, inside the keyword:
My Keyword That Accepts Optional List
[Arguments] $the_list=$None
$the default value= Create List member0 the other one
$the_list= Set Variable If $the_list is None $the default value # no argument passed when the keyword was called
... $the_list # an argument was passed, leave the variable as it was
answered Mar 30 at 5:32


Todor MinakovTodor Minakov
8,9261 gold badge29 silver badges39 bronze badges
8,9261 gold badge29 silver badges39 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55351148%2fhow-can-i-add-an-optional-list-parameter-to-my-keyword-at-robotframework%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Can you explain what you've tried and what the error is that you're seeing?
– A. Kootstra
Mar 26 at 7:47
Are you writing this keyword in robot, in python, or some other language? It would help if you could provide a minimal reproducible example that shows us what you've tried.
– Bryan Oakley
Mar 26 at 13:05