Forum Discussion
nmrao
Champion Level 3
How about this?
context.testCase.testSuite.setPropertyValue('name', 'value')
sumeet0420
6 years agoNew Contributor
I want to pass a variable that is defined in test suite with value as an Object and use in the subsequent test cases.
For eg. My test suite has set up script which defines a context variable as follows
context.testSuiteVariable = new HelloWorld()
I want to use this context.testSuiteVariable in my test case. Any idea how to achieve this?
For eg. My test suite has set up script which defines a context variable as follows
context.testSuiteVariable = new HelloWorld()
I want to use this context.testSuiteVariable in my test case. Any idea how to achieve this?
- nmrao6 years agoChampion Level 3
- HimanshuTayal6 years agoCommunity Hero
Hi sumeet0420 ,
In your TestSuite you can assign value to context variable by below:
context.setProperty("varName", varValue);
And in your TestCase, you can use the value by below:
log.info context.varName
- sumeet04206 years agoNew ContributorHi,
This will not work as TestSuite context is different from TestCase object.
Test Case Context is an instance of TestCaseRunContext while Test Suite Context is an instance of TestSuiteRunContext.- nmrao6 years agoChampion Level 3I could not related your response to which reply.
Can you provide more details?
Have you tried the given solution before saying this will not work?
Related Content
- 2 years ago
- 4 years ago