Ask a Question

Make all Data Source properties available to another called test case

SOLVED
pricedgp
Contributor

Make all Data Source properties available to another called test case

Using groovy, I know that I can run another test case from the current test case, and pass context properties from the current test case into it, like so:

 

 

// get reference to that case and run it
def testCase = testRunner.testCase.testSuite.project.getTestSuiteByName(targetSuiteName).getTestCaseByName(targetTestCaseName)

// get properties from caller and pass to callee
def contextMap = new StringToObjectMap( context )

testCase.run(contextMap, false )

 

But, it seems that the context properties do not include the data source properties (unless I've missed something). So, my called test case doesn't have access to those properties. 

 

Is there a way to make all of the data source properties available to the called test case?

 

Thanks!

 

 

1 REPLY 1
TanyaYatskovska
SmartBear Alumni (Retired)

Hi Pricedgp,

 

I suppose that you can use the put method to add values of DataSource properties to your contextMap. For example, here is how the code looks on my computer:

def contextMap = new StringToObjectMap( context )
def from = context.expand( '${JDBC Data#From}' )
contextMap.put("datasourceFrom", from)

Here is an article containing a description of the method:

http://docs.oracle.com/javase/6/docs/api/java/util/HashMap.html#put(K, V)

 

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager



cancel
Showing results for 
Search instead for 
Did you mean: