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;








-1















I am trying to add optional dictionary and list to my keyword, how can assign their default values?










share|improve this question






















  • 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

















-1















I am trying to add optional dictionary and list to my keyword, how can assign their default values?










share|improve this question






















  • 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













-1












-1








-1








I am trying to add optional dictionary and list to my keyword, how can assign their default values?










share|improve this question














I am trying to add optional dictionary and list to my keyword, how can assign their default values?







robotframework






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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

















  • 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












2 Answers
2






active

oldest

votes


















3














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





share|improve this answer






























    0














    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





    share|improve this answer

























      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
      );



      );













      draft saved

      draft discarded


















      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









      3














      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





      share|improve this answer



























        3














        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





        share|improve this answer

























          3












          3








          3







          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





          share|improve this answer













          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






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 26 at 7:50









          NomceNomce

          5901 gold badge4 silver badges16 bronze badges




          5901 gold badge4 silver badges16 bronze badges























              0














              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





              share|improve this answer



























                0














                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





                share|improve this answer

























                  0












                  0








                  0







                  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





                  share|improve this answer













                  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






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  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



























                      draft saved

                      draft discarded
















































                      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.




                      draft saved


                      draft discarded














                      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





















































                      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







                      Popular posts from this blog

                      How to preserve electronics (computers, tablets and phones) for hundreds of years Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) The network's official Twitter account is up and running again. What content…How might modern humans leave a message for 50,000 years?How would an aquatic race develop computers?How do we make computers care for human life?Keeping supplies for 1000 yearsWhat will cell phones become in 100 years?What body armor protects against a laser?Could a society attain 1800s technology if limited to using copper and bronze?Electricity power (magic) and electronicsScavenging metal resources in post-apocalypse after 100 yearsWhy would precursors create devices that can survive and still work after hundreds of years?

                      155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해

                      Convert JSON to MapSimplest way to convert a string representing JSON array into Java array List of key value pairsHow to take String JSON values into HashMapConvert a JSON String to a HashMapCreating BSON object from JSON stringJSONObject - How to get a value ?Better Map ConstructorReading JSON from Url javaUpdate columns if input values are not null otherwise ignore and keep the existing values of column in databaseHow to store object represented as Json string into Couchbase Lite?Go JSON into MapHow do I efficiently iterate over each entry in a Java Map?Sort a Map<Key, Value> by valuesHow to round a number to n decimal places in JavaCan comments be used in JSON?How do I read / convert an InputStream into a String in Java?How can I pretty-print JSON in a shell script?What is the correct JSON content type?How can I deserialize JSON to a simple Dictionary<string,string> in ASP.NET?Why does Google prepend while(1); to their JSON responses?Parse JSON in JavaScript?