enthusiastictes
13 years agoOccasional Contributor
How to Automate JDBC Step
Hi,
In my tests I have to log in to the DB & check for logging in DB for every Request/Response.
I query the DB based on a unique ID which I send in the SOAP Request.
I want to automate this step in SOAP UI now.
Right now in SOAP UI :
I've created a Test Suite in which the Test case has the following Test Steps :
1. Properties - which need to be passed to the SOAP Request
2. Groovy Script - which assigns Properties to the elements in the XML SOAP request based on XPath [Ex : holder("ns1://Txn ID)=TransactionID]
3. SOAP Request
4. Loop - which loops for 'n' number of iterations.
For each iteration, the Groovy script assigns the properties to the elements in the SOAP Request from the Properties step
for ex : Properties Step has the following Properties :
(TransactionID1=111
Amount1=120
Item1=Notebook
TransactionID2=222
Amount2=100
Item2=Pen)
Groovy Script Step has the following line which assigns Properties to the SOAP Script :
def TxnID = testRunner.testCase.getTestStepByName("Properties").getPropertyValue("TransactionID"+context.loopIndex)
And each time the loopIndex will iterate :
For 1st iteration - Transaction ID1, Amount1 & Item1 are passed & for 2nd Iteration - Transaction ID2, Amount2 & Item2)
Now I want to add a JDBC Step after the SOAP Request step which automatically pulls the TransactionID automatically for every iteration.
My SQL query would look something like :
select * from table_name where transaction = " "
I want to pass TransactionID1(=111) in first iteration & in the 2nd iteration TransactionID2(=222)
Manually : for every iteration i am able to execute the following to get the results :
select * from table_name where transaction = $Properties#TransactionID1
and then have to change it to :
select * from table_name where transaction = $Properties#TransactionID2
I want to automate this step too.
Please advise,
Many Thanks
In my tests I have to log in to the DB & check for logging in DB for every Request/Response.
I query the DB based on a unique ID which I send in the SOAP Request.
I want to automate this step in SOAP UI now.
Right now in SOAP UI :
I've created a Test Suite in which the Test case has the following Test Steps :
1. Properties - which need to be passed to the SOAP Request
2. Groovy Script - which assigns Properties to the elements in the XML SOAP request based on XPath [Ex : holder("ns1://Txn ID)=TransactionID]
3. SOAP Request
4. Loop - which loops for 'n' number of iterations.
For each iteration, the Groovy script assigns the properties to the elements in the SOAP Request from the Properties step
for ex : Properties Step has the following Properties :
(TransactionID1=111
Amount1=120
Item1=Notebook
TransactionID2=222
Amount2=100
Item2=Pen)
Groovy Script Step has the following line which assigns Properties to the SOAP Script :
def TxnID = testRunner.testCase.getTestStepByName("Properties").getPropertyValue("TransactionID"+context.loopIndex)
And each time the loopIndex will iterate :
For 1st iteration - Transaction ID1, Amount1 & Item1 are passed & for 2nd Iteration - Transaction ID2, Amount2 & Item2)
Now I want to add a JDBC Step after the SOAP Request step which automatically pulls the TransactionID automatically for every iteration.
My SQL query would look something like :
select * from table_name where transaction = " "
I want to pass TransactionID1(=111) in first iteration & in the 2nd iteration TransactionID2(=222)
Manually : for every iteration i am able to execute the following to get the results :
select * from table_name where transaction = $Properties#TransactionID1
and then have to change it to :
select * from table_name where transaction = $Properties#TransactionID2
I want to automate this step too.
Please advise,
Many Thanks