Forum Discussion

vsumathi's avatar
vsumathi
Occasional Contributor
4 years ago
Solved

Run a shared Keyword test in different projects with different parameters

I have the functionality to import an excel sheet (File A) in one of my project (Project A).  I am using this same functionality in a different project (project B) using a 'shared keyword test'.  When running project B I want to use a different Excel File (File B) in that shared Keyword test. 

I created two parameters 'Excel A' and 'Excel B'. But the problem is, every time I change the parameter in one of my projects the other one is also getting updated with the file. 

I should be able to run the entire project suite using Parameter Excel A in one project and parameter Excel B in the other project.

Let me know your thoughts.

  • Hi,

     

    I can think about two options:

    -- Either assign a proper value to the parameter of your keyword test before calling it; or

    -- Combine test projects via different test suites and use Project Suite Variables to keep required values for the parameter.

     

  • Okay, you can't change the parameter between project because you are sharing it.  However, you can change the value that you pass through the parameter.  To do that, use one of AlexKaras 's suggestions and have a variable for each value.  

     

    The parameter will always be the same but for Project A you give it one value and for Project B you give it another 

     

    If you need more help, please post a screenshot of the keyword test where you have this definition, including some code above and below the definition.

6 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    I can think about two options:

    -- Either assign a proper value to the parameter of your keyword test before calling it; or

    -- Combine test projects via different test suites and use Project Suite Variables to keep required values for the parameter.

     

  • Marsha_R's avatar
    Marsha_R
    Champion Level 3

    It sounds like you are saving these parameters somewhere?  If you're going to do that, they need unique names  Try something like this (with your syntax of course).

     

    variable ProjectAExcel = ExcelA

    variable ProjectBExcel = ExcelB

     

     

    Project A

    call MyKeywordTest(ProjectAExcel)

     

    ProjectB

    call MyKeywordTest(ProjectBExcel)

     

    • vsumathi's avatar
      vsumathi
      Occasional Contributor

      Since I am sharing the Keyword test, If I create a parameter for the Keyword test in Project A it's getting shared with Project B also. I want to use different parameters for the shared keyword test in different projects when I run the entire project suite.

      • Marsha_R's avatar
        Marsha_R
        Champion Level 3

        Different parameters or different values for the same parameters?