cancel
Showing results for 
Search instead for 
Did you mean: 

Property trasfer from one test suit to another test suit

Chowdhary
Contributor

Property trasfer from one test suit to another test suit

How can I transfer the properties from one test suit to another, right now I am using the xpath to transfer the values

What is the best way to do this & how to do it with property transfer ?

Vam
7 REPLIES 7
msiadak
Community Hero

Re: Property trasfer from one test suit to another test suit

I do not think that Property Transfer steps can accomplish this. I typically write a groovy script to handle moving values from one test suite to another. 




---

Click the Accept as Solution button if my answer has helped, and remember to give kudos where appropriate too!
Chowdhary
Contributor

Re: Property trasfer from one test suit to another test suit

I can know any sample groovy script for transfer the values ?

Vam
nmrao
Community Hero

Re: Property trasfer from one test suit to another test suit

What is your use case? If the data is common across the suites, then best way is to use Project level property instead of Test Suite level.


Regards,
Rao.
Chowdhary
Contributor

Re: Property trasfer from one test suit to another test suit

How to use the project level property or groovy script.

Vam
nmrao
Community Hero

Re: Property trasfer from one test suit to another test suit

Set Project Level property Using Groovy Script:

 

Note that only String Type values are supported. In case, if the data type is other than string, user needs to change type explicitly while setting and getting.

 

Below are some common examples with different types.

 

# String Type

How to set 

context.testCase.testSuite.project.setPropertyValue('PROPERTY_NAME', 'PROPERTY_VALUE')

 

How to get

def retriveValue = context.testCase.testSuite.project.getPropertyValue('PROPERTY_NAME')

 

 

#Integer Type

How to set

 

def value = 10
context.testCase.testSuite.project.setPropertyValue('PROPERTY_NAME', value.toString())

 

 

How to get 

 

def retriveValue = context.testCase.testSuite.project.getPropertyValue('PROPERTY_NAME') as Integer
assert retriveValue instanceof Integer, 'Value is not an Integer type'

 

 

# Boolean Type

How to set 

 

def value = true
context.testCase.testSuite.project.setPropertyValue('PROPERTY_NAME', value.toString())

 

 

How to get 

 

def retriveValue = context.testCase.testSuite.project.getPropertyValue('PROPERTY_NAME')?.toBoolean()
assert retriveValue instance of Boolean, 'Value is not a Boolean type'

 

 

Property Transfer:

And I believe that you would see Project an option in the Target drop down so that one would able to save the xpath selected value into a property which is similar to test suite which you are talking about.

 



Regards,
Rao.
Chowdhary
Contributor

Re: Property trasfer from one test suit to another test suit

I Tried from using the groovy code what you gave, when I run it am getting an error like missing source property, can I have through any example to understand a bit....

Vam
nmrao
Community Hero

Re: Property trasfer from one test suit to another test suit

Please show that script and error that you get.


Regards,
Rao.
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors