cancel
Showing results for 
Search instead for 
Did you mean: 

Run a shared Keyword test in different projects with different parameters

SOLVED
Highlighted
Occasional Contributor

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.

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Community Hero

Re: Run a shared Keyword test in different projects with different parameters

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.

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================

View solution in original post

Highlighted
Community Hero

Re: Run a shared Keyword test in different projects with different parameters

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.

View solution in original post

6 REPLIES 6
Highlighted
Community Hero

Re: Run a shared Keyword test in different projects with different parameters

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)

 

Highlighted
Occasional Contributor

Re: Run a shared Keyword test in different projects with different parameters

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.

Highlighted
Community Hero

Re: Run a shared Keyword test in different projects with different parameters

Different parameters or different values for the same parameters?

Highlighted
Community Hero

Re: Run a shared Keyword test in different projects with different parameters

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.

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================

View solution in original post

Highlighted
Occasional Contributor

Re: Run a shared Keyword test in different projects with different parameters

I created two parameters inside the 'Keyword Test' of project A and shared the 'Keyword Test' with project B.

For Project A I want to use parameter 'Excel A'

For Project B I want to use parameter 'Excel B'

But since I am sharing the same Keyword test between projects A and B, When I run the entire project suite it is taking the parameter from the first ran project ( Say for eg Project A) and defaulting to the next project (project B). 

 

My Requirement:

Share a keyword test between Project A and Project B

Run the Project Suite, use the shared keyword test with the parameter 'Excel A' for 'Project A' and 'Excel B' for 'Project B'.

Tags (1)
Highlighted
Community Hero

Re: Run a shared Keyword test in different projects with different parameters

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.

View solution in original post

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors