Steps to parameterize Test Data from DB in soapUI

In continuation with my earlier post on Establishing DB Connection in soapUI, today I shall write about  how to parameterize a test data from DB into your soap client and test your web service.

Now that we have established DB connection and as we are able to get the DB response as XML, We shall now see how to extract the value from the DB response and pass it  as an input to our service request.

Let’s look at the default Currency Convertor request structure.




Here we need to extract relevant values from our query output and pass it as input to the FromCurrency and ToCurrency Request elements i.e. replace "?" mark with the values extracted from the query output. To do the same just follow the below steps.
Add a Property Transfer Step as shown below.

















Specify the name for the step.








In the Property Transfer window, Add a new Property Transfer as shown below.
















Specify a name for the value transfer.








On the right side configure the following.
Source: JDBC Request, Property : ResponseAsXML, write the XPath as shown below to extract the very first row value from the JDBC Resultset
Target: ConversionRate Soap Client, Property : Request and write the XPath to locate to your request element as shown in the figure below.















In this example I am trying to extract Row 1 Value from the Query ResultSet and pass it as an input to FromCurrency Request element. Click on the Run button to make sure that the Property Transfer is successful.
Similarly add another Property Transfer Value to extract 3rd row result from the JDBC output and pass it as an input to ToCurrency element of the service Request.














Now that we have completed adding Property Transfer values, we are good to execute our Test Suite/Test Case. Double Click on either Test Suite or Test Case and click on the Green arrow button to execute all the test steps in a sequence as shown below.





















Isn't that cool..!! :) Let us check out the traffic by double clicking the Currency Convertor SOAP Client as shown below.






If you want to save the request and response traffic locally then it can be done dynamically with the help of Groovy. For details refer to my previous post "Groovy Script to save Test Results to a file in soapUI"

This is all about extracting the values from DB and using it as a Test Data to test web services in soapUI. Let me know if you face any issues in reproducing the above steps and also let me know your thoughts on the same.

 
Technorati Tags: ,,,,,
Steps to parameterize Test Data from DB in soapUI Steps to parameterize Test Data from DB in soapUI Reviewed by Suntaragali The Smart Techie on March 06, 2013 Rating: 5

9 comments:

  1. Hi

    Your postings helped me a lot to learn database connection using soapui.

    Tahnks very much

    ReplyDelete
  2. hi buddy, you postings are super, i appreciate your effort for sharing the knowledge.

    I have one query out here for adding the target path. if you can give your email id , i can explain you about my problem with screenshots

    ReplyDelete
    Replies
    1. Vasudev,

      Please send me your query to qaautomationspecialist@gmail.com

      Delete
    2. hi thanks for your reply,

      please write a post for getting test data from groovy scripting to request XML

      Delete
  3. Thanks for this excellent post regarding the steps to parameterize test data from DB in soap ui, it was really helpful. But just wanted to clarify that you were reading only Row 1 value, right? But in my test I wanted to run the test for 100 accounts from a table. So would you please let me know how I can read all 100 or X number of accounts. Your help will be much appreciated.

    Thanks!
    Agi

    ReplyDelete
  4. TY SO MUCH!! i am searching the solution for an hour.. :)

    ReplyDelete