Setting the query of a JDBC datasource dynamically in TestCase setupScript

This is community board for the soapUI Community. Here the members can exchange experiences and help each other improve their soapUI testing.

Setting the query of a JDBC datasource dynamically in TestCase setupScript

Postby Tareque » 31 Jan 2008 20:48

Hi,
Is it possible to set the query for a JDBC DataSource dynamically through the SetUp script of a TestCase?

I have to fetch the query from a DB in the SetUp script and set it in the dataSource which has already been created

def dataSource = testRunner.getTestCase().getTestStepByName("DataSource")
Tareque
User
 
Posts: 17
Joined: 01 Nov 2007 17:35

Re: Setting the query of a JDBC datasource dynamically in TestCase setupScript

Postby omatzura » 31 Jan 2008 23:52

Hi Tareque,

sure! Create a property at either the TestCase level or in a Properties-step, initialize that property in your setup-script (or any other way), and then expand it in your query. So if you create a property called "sqlQuery" at the TestCase level, then you can expand it with ${#TestCase#sqlQuery}

Hope this helps!

regards,

/Ole
eviware.com
omatzura
Administrator
Administrator
 
Posts: 1918
Joined: 05 Jan 2007 23:39

Re: Setting the query of a JDBC datasource dynamically in TestCase setupScript

Postby Tareque » 01 Feb 2008 17:30

Thanks Ole. You suggestions as always was spot on.
Tareque
User
 
Posts: 17
Joined: 01 Nov 2007 17:35


Return to soapUI Community Board