cancel
Showing results for 
Search instead for 
Did you mean: 

How do I setup test case property key using a variable value?

SOLVED
Occasional Contributor

How do I setup test case property key using a variable value?

def a = Property1

testRunner.testCase.addProperty(<Value of a>)

 

As you can see in the above piece of code, I have declared a variable named 'a' and assigned a value of Property1. Now how do I add a property using the variable 'a'?

1 ACCEPTED SOLUTION

Accepted Solutions
Community Hero

Re: How do I setup test case property key using a variable value?

It is equally simple:

 

def a = "Property1"

testRunner.testCase.setPropertyValue(a, "")


If my answer helped please click on the 'Accept as Solution' button.

View solution in original post

5 REPLIES 5
Community Hero

Re: How do I setup test case property key using a variable value?

testRunner.testCase.setPropertyValue("nameForYourTestCaseProperty", a)

That's all. The above method should add the property to your test case if the property doesn't already exist.


If my answer helped please click on the 'Accept as Solution' button.
Occasional Contributor

Re: How do I setup test case property key using a variable value?

Hi Lucian,

 

Thanks for your reply. I want to add a property name (key) using a variable value and not the property value. How do I do that?

Community Hero

Re: How do I setup test case property key using a variable value?

It is equally simple:

 

def a = "Property1"

testRunner.testCase.setPropertyValue(a, "")


If my answer helped please click on the 'Accept as Solution' button.

View solution in original post

Occasional Contributor

Re: How do I setup test case property key using a variable value?

Hi Lucian,

 

How do I add a property named Property1 at test case level using the variable 'a' reference?

Community Hero

Re: How do I setup test case property key using a variable value?

The code from my previous answer should work well.


If my answer helped please click on the 'Accept as Solution' button.
New Here?
Join us and watch the welcome video:
Watch the new Interview
Top Kudoed Authors