How to use Variable and UserKeyword from test case level, which created at project level





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















How to use Variable and UserKeyword from test case level, which created at project level.



I have a robot framework project like:



Project
Suite1
TC_001
TC_002
Suite2
TC_003
TC_004


I have create Variable and UserKeyword at project level and I want to use those Variable and UserKeyword from test case level. My question is, how to use them at test case level?










share|improve this question

























  • Under Settings you have to call the file as resource. Example: Let say you have ${username}= Random in suite1.robot. You have to call suite1.robot in file you want to use *** Settings *** Resource Suite1.robot *** Test Case *** Suite Variable Check Log ${username}

    – Shiva Prasad Adirala
    Nov 29 '18 at 5:40




















0















How to use Variable and UserKeyword from test case level, which created at project level.



I have a robot framework project like:



Project
Suite1
TC_001
TC_002
Suite2
TC_003
TC_004


I have create Variable and UserKeyword at project level and I want to use those Variable and UserKeyword from test case level. My question is, how to use them at test case level?










share|improve this question

























  • Under Settings you have to call the file as resource. Example: Let say you have ${username}= Random in suite1.robot. You have to call suite1.robot in file you want to use *** Settings *** Resource Suite1.robot *** Test Case *** Suite Variable Check Log ${username}

    – Shiva Prasad Adirala
    Nov 29 '18 at 5:40
















0












0








0


1






How to use Variable and UserKeyword from test case level, which created at project level.



I have a robot framework project like:



Project
Suite1
TC_001
TC_002
Suite2
TC_003
TC_004


I have create Variable and UserKeyword at project level and I want to use those Variable and UserKeyword from test case level. My question is, how to use them at test case level?










share|improve this question
















How to use Variable and UserKeyword from test case level, which created at project level.



I have a robot framework project like:



Project
Suite1
TC_001
TC_002
Suite2
TC_003
TC_004


I have create Variable and UserKeyword at project level and I want to use those Variable and UserKeyword from test case level. My question is, how to use them at test case level?







robotframework






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 29 '18 at 6:23









A. Kootstra

4,60721233




4,60721233










asked Nov 29 '18 at 5:05









Al ImranAl Imran

701418




701418













  • Under Settings you have to call the file as resource. Example: Let say you have ${username}= Random in suite1.robot. You have to call suite1.robot in file you want to use *** Settings *** Resource Suite1.robot *** Test Case *** Suite Variable Check Log ${username}

    – Shiva Prasad Adirala
    Nov 29 '18 at 5:40





















  • Under Settings you have to call the file as resource. Example: Let say you have ${username}= Random in suite1.robot. You have to call suite1.robot in file you want to use *** Settings *** Resource Suite1.robot *** Test Case *** Suite Variable Check Log ${username}

    – Shiva Prasad Adirala
    Nov 29 '18 at 5:40



















Under Settings you have to call the file as resource. Example: Let say you have ${username}= Random in suite1.robot. You have to call suite1.robot in file you want to use *** Settings *** Resource Suite1.robot *** Test Case *** Suite Variable Check Log ${username}

– Shiva Prasad Adirala
Nov 29 '18 at 5:40







Under Settings you have to call the file as resource. Example: Let say you have ${username}= Random in suite1.robot. You have to call suite1.robot in file you want to use *** Settings *** Resource Suite1.robot *** Test Case *** Suite Variable Check Log ${username}

– Shiva Prasad Adirala
Nov 29 '18 at 5:40














2 Answers
2






active

oldest

votes


















2














From the Robot Framework User Guide there are two sections you may want to go through in more detail:




  • Variables

  • Resource and variable files


Both of these describe how to import variables and external keywords from external files. In essence a resource file is a regular robot file but without the test cases. It only contains keywords and has the regular settings and variable sections. It can be imported in your test suite file through the Resource common.robot construct:



*** Settings ***
Resource common.robot
Resource feature_1.robot
Resource feature_2.robot


*** Variables ***
${HOST} localhost:7272

*** Keywords ***
Open Login Page
Do something





share|improve this answer


























  • Thanks for your effort, one more question could you please tell me the best practice naming conversion of Resource file where more than one word?

    – Al Imran
    Dec 4 '18 at 12:30











  • Can i use multiple resources file under one suite?

    – Al Imran
    Dec 4 '18 at 12:47











  • As the resource name is the file name your limitations are typically the ones imposed by your OS. So I'd stick with either CamelCase or use of under_scores . As you can also use directory names ./common/browser.robot and ./common/general.robot or ./application/feature/function.robot` make for a good way to keep your code maintainable.

    – A. Kootstra
    Dec 4 '18 at 12:49











  • Yes. I've updated the example to show this.

    – A. Kootstra
    Dec 4 '18 at 12:50



















2














You'll have to import the file created in the "Project" directory, and afterwards you'll have access to the variables and keywords defined in it.



If the file there is called "The_project_file.robot", in "Suite_1.robot":



*** Settings ***
Resource ../The_project_file.robot

*** Test Case ***
TC_001
Log ${variable defined in The_project_file}
${value}= Keyword Defined In The Project File





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%2f53532186%2fhow-to-use-variable-and-userkeyword-from-test-case-level-which-created-at-proje%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









    2














    From the Robot Framework User Guide there are two sections you may want to go through in more detail:




    • Variables

    • Resource and variable files


    Both of these describe how to import variables and external keywords from external files. In essence a resource file is a regular robot file but without the test cases. It only contains keywords and has the regular settings and variable sections. It can be imported in your test suite file through the Resource common.robot construct:



    *** Settings ***
    Resource common.robot
    Resource feature_1.robot
    Resource feature_2.robot


    *** Variables ***
    ${HOST} localhost:7272

    *** Keywords ***
    Open Login Page
    Do something





    share|improve this answer


























    • Thanks for your effort, one more question could you please tell me the best practice naming conversion of Resource file where more than one word?

      – Al Imran
      Dec 4 '18 at 12:30











    • Can i use multiple resources file under one suite?

      – Al Imran
      Dec 4 '18 at 12:47











    • As the resource name is the file name your limitations are typically the ones imposed by your OS. So I'd stick with either CamelCase or use of under_scores . As you can also use directory names ./common/browser.robot and ./common/general.robot or ./application/feature/function.robot` make for a good way to keep your code maintainable.

      – A. Kootstra
      Dec 4 '18 at 12:49











    • Yes. I've updated the example to show this.

      – A. Kootstra
      Dec 4 '18 at 12:50
















    2














    From the Robot Framework User Guide there are two sections you may want to go through in more detail:




    • Variables

    • Resource and variable files


    Both of these describe how to import variables and external keywords from external files. In essence a resource file is a regular robot file but without the test cases. It only contains keywords and has the regular settings and variable sections. It can be imported in your test suite file through the Resource common.robot construct:



    *** Settings ***
    Resource common.robot
    Resource feature_1.robot
    Resource feature_2.robot


    *** Variables ***
    ${HOST} localhost:7272

    *** Keywords ***
    Open Login Page
    Do something





    share|improve this answer


























    • Thanks for your effort, one more question could you please tell me the best practice naming conversion of Resource file where more than one word?

      – Al Imran
      Dec 4 '18 at 12:30











    • Can i use multiple resources file under one suite?

      – Al Imran
      Dec 4 '18 at 12:47











    • As the resource name is the file name your limitations are typically the ones imposed by your OS. So I'd stick with either CamelCase or use of under_scores . As you can also use directory names ./common/browser.robot and ./common/general.robot or ./application/feature/function.robot` make for a good way to keep your code maintainable.

      – A. Kootstra
      Dec 4 '18 at 12:49











    • Yes. I've updated the example to show this.

      – A. Kootstra
      Dec 4 '18 at 12:50














    2












    2








    2







    From the Robot Framework User Guide there are two sections you may want to go through in more detail:




    • Variables

    • Resource and variable files


    Both of these describe how to import variables and external keywords from external files. In essence a resource file is a regular robot file but without the test cases. It only contains keywords and has the regular settings and variable sections. It can be imported in your test suite file through the Resource common.robot construct:



    *** Settings ***
    Resource common.robot
    Resource feature_1.robot
    Resource feature_2.robot


    *** Variables ***
    ${HOST} localhost:7272

    *** Keywords ***
    Open Login Page
    Do something





    share|improve this answer















    From the Robot Framework User Guide there are two sections you may want to go through in more detail:




    • Variables

    • Resource and variable files


    Both of these describe how to import variables and external keywords from external files. In essence a resource file is a regular robot file but without the test cases. It only contains keywords and has the regular settings and variable sections. It can be imported in your test suite file through the Resource common.robot construct:



    *** Settings ***
    Resource common.robot
    Resource feature_1.robot
    Resource feature_2.robot


    *** Variables ***
    ${HOST} localhost:7272

    *** Keywords ***
    Open Login Page
    Do something






    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Dec 4 '18 at 12:50

























    answered Nov 29 '18 at 6:32









    A. KootstraA. Kootstra

    4,60721233




    4,60721233













    • Thanks for your effort, one more question could you please tell me the best practice naming conversion of Resource file where more than one word?

      – Al Imran
      Dec 4 '18 at 12:30











    • Can i use multiple resources file under one suite?

      – Al Imran
      Dec 4 '18 at 12:47











    • As the resource name is the file name your limitations are typically the ones imposed by your OS. So I'd stick with either CamelCase or use of under_scores . As you can also use directory names ./common/browser.robot and ./common/general.robot or ./application/feature/function.robot` make for a good way to keep your code maintainable.

      – A. Kootstra
      Dec 4 '18 at 12:49











    • Yes. I've updated the example to show this.

      – A. Kootstra
      Dec 4 '18 at 12:50



















    • Thanks for your effort, one more question could you please tell me the best practice naming conversion of Resource file where more than one word?

      – Al Imran
      Dec 4 '18 at 12:30











    • Can i use multiple resources file under one suite?

      – Al Imran
      Dec 4 '18 at 12:47











    • As the resource name is the file name your limitations are typically the ones imposed by your OS. So I'd stick with either CamelCase or use of under_scores . As you can also use directory names ./common/browser.robot and ./common/general.robot or ./application/feature/function.robot` make for a good way to keep your code maintainable.

      – A. Kootstra
      Dec 4 '18 at 12:49











    • Yes. I've updated the example to show this.

      – A. Kootstra
      Dec 4 '18 at 12:50

















    Thanks for your effort, one more question could you please tell me the best practice naming conversion of Resource file where more than one word?

    – Al Imran
    Dec 4 '18 at 12:30





    Thanks for your effort, one more question could you please tell me the best practice naming conversion of Resource file where more than one word?

    – Al Imran
    Dec 4 '18 at 12:30













    Can i use multiple resources file under one suite?

    – Al Imran
    Dec 4 '18 at 12:47





    Can i use multiple resources file under one suite?

    – Al Imran
    Dec 4 '18 at 12:47













    As the resource name is the file name your limitations are typically the ones imposed by your OS. So I'd stick with either CamelCase or use of under_scores . As you can also use directory names ./common/browser.robot and ./common/general.robot or ./application/feature/function.robot` make for a good way to keep your code maintainable.

    – A. Kootstra
    Dec 4 '18 at 12:49





    As the resource name is the file name your limitations are typically the ones imposed by your OS. So I'd stick with either CamelCase or use of under_scores . As you can also use directory names ./common/browser.robot and ./common/general.robot or ./application/feature/function.robot` make for a good way to keep your code maintainable.

    – A. Kootstra
    Dec 4 '18 at 12:49













    Yes. I've updated the example to show this.

    – A. Kootstra
    Dec 4 '18 at 12:50





    Yes. I've updated the example to show this.

    – A. Kootstra
    Dec 4 '18 at 12:50













    2














    You'll have to import the file created in the "Project" directory, and afterwards you'll have access to the variables and keywords defined in it.



    If the file there is called "The_project_file.robot", in "Suite_1.robot":



    *** Settings ***
    Resource ../The_project_file.robot

    *** Test Case ***
    TC_001
    Log ${variable defined in The_project_file}
    ${value}= Keyword Defined In The Project File





    share|improve this answer




























      2














      You'll have to import the file created in the "Project" directory, and afterwards you'll have access to the variables and keywords defined in it.



      If the file there is called "The_project_file.robot", in "Suite_1.robot":



      *** Settings ***
      Resource ../The_project_file.robot

      *** Test Case ***
      TC_001
      Log ${variable defined in The_project_file}
      ${value}= Keyword Defined In The Project File





      share|improve this answer


























        2












        2








        2







        You'll have to import the file created in the "Project" directory, and afterwards you'll have access to the variables and keywords defined in it.



        If the file there is called "The_project_file.robot", in "Suite_1.robot":



        *** Settings ***
        Resource ../The_project_file.robot

        *** Test Case ***
        TC_001
        Log ${variable defined in The_project_file}
        ${value}= Keyword Defined In The Project File





        share|improve this answer













        You'll have to import the file created in the "Project" directory, and afterwards you'll have access to the variables and keywords defined in it.



        If the file there is called "The_project_file.robot", in "Suite_1.robot":



        *** Settings ***
        Resource ../The_project_file.robot

        *** Test Case ***
        TC_001
        Log ${variable defined in The_project_file}
        ${value}= Keyword Defined In The Project File






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 29 '18 at 6:34









        Todor MinakovTodor Minakov

        7,79712739




        7,79712739






























            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%2f53532186%2fhow-to-use-variable-and-userkeyword-from-test-case-level-which-created-at-proje%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

            Contact image not getting when fetch all contact list from iPhone by CNContact

            count number of partitions of a set with n elements into k subsets

            A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks