Forum Discussion
AYedidya
11 years agoNew Contributor
Hi,
Using context.setProperty & context.getProperty , I am able to get the hashtable from script#1 and use it on script#2 but in order to do that, I have to run script #1 from script#2 and only then, I can access the hashtable.
I do not want to run the entire script #1 from script#2 (script #1 already ran before I execute script#2 so it will run twice if I run It also from script#2)
How can I only get the hashtable from script #1 and use it on script #2 without running script #1 from script #2?
Script #1 – (MetaData):
context.setProperty( "metadata", new MetaData( log, context, testRunner) )
def metaDataHashtable = new Hashtable()
metaDataHashtable.put("key_1","value_1")
metaDataHashtable.put("key_2","value_2")
metaDataHashtable.put ……………..
context.setProperty("metaDataHashtable",metaDataHashtable )
Script #2:
module_1 = testSuite.testCases["TestCase_Name"].testSteps["MetaData"]
module_1.run(testRunner,context) – this line runs script#1
def metadata = context.metadata
log.info metadata.context.getProperty("metaDataHashtable")
Thank you!
Using context.setProperty & context.getProperty , I am able to get the hashtable from script#1 and use it on script#2 but in order to do that, I have to run script #1 from script#2 and only then, I can access the hashtable.
I do not want to run the entire script #1 from script#2 (script #1 already ran before I execute script#2 so it will run twice if I run It also from script#2)
How can I only get the hashtable from script #1 and use it on script #2 without running script #1 from script #2?
Script #1 – (MetaData):
context.setProperty( "metadata", new MetaData( log, context, testRunner) )
def metaDataHashtable = new Hashtable()
metaDataHashtable.put("key_1","value_1")
metaDataHashtable.put("key_2","value_2")
metaDataHashtable.put ……………..
context.setProperty("metaDataHashtable",metaDataHashtable )
Script #2:
module_1 = testSuite.testCases["TestCase_Name"].testSteps["MetaData"]
module_1.run(testRunner,context) – this line runs script#1
def metadata = context.metadata
log.info metadata.context.getProperty("metaDataHashtable")
Thank you!
Related Content
- 4 years agoRobertPeip
- 6 years agomriedmuel