Web Service Call to a Database

CloudTest provides both SOAP and REST methods to call a database using whatever API is provided. In the following example, we will use a SOAP service to get name from a MySQL database.

How to

  1. Create a SOAP web service that extracts data from a database.
  2. Identify the URL to the SOAP service’s WSDL file.This example uses MySQL as the source database. For example, a WSDL that extracts data from MySQL.
  3. Create a CloudTest SOAP target pointing at this new SOAP web service. See Create a New Target in Target for instructions.For example: http://soasta_server/soap-sql-demo/services/SQLService?wsdl
  4. Create a CloudTest test clip that uses this new target. See Creating a New Clip for instructions.The example test clip will query data from a MySQL database using select statements in the executeQuery operation of the newly created target.
  5. With the new test clip open, double-click the MySQL target (in the lower-left pane of the Clip Editor) to add it to the “Included Targets” list.
  6. Double-click the executeQuery operation (in the lower-right pane of the Clip Editor) to add an empty SOAP message to the test clip.
  7. Double-click Message 1 to open its properties in the lower panel.
  8. Edit the Input. , the SQL being run will be: select FirstName, LastName from Contacts where id='1' In this sample, we are extracting one record at a time.
  9. Click Play in the Message Editor panel. The single SOAP request is sent to the destination server.
  10. The XML request sent is shown in the lower-left pane of the test clip editor and the results of the query will be shown in the lower-right pane of the test clip editor. The data returned by this query can now be used in subsequent steps in the test.
  11. Click in a field with the data you want to use (the field with “Aaron” is selected in the image to the right).Click the Properties icon on the right to access the Property Chooser dialog box.
  12. Assign the data that comes back in this query to the selected Property. In this case, a global property named “Contact Data/First Name” has been selected as the property to store this data.
  13. Repeat this process for each data element you want stored in a property. When you want to use this property in a test message, you use it like any other property. In an input field, simply click the white properties icon, select the property you want included in your input, and then click OK.

What you should see

Note: As usual, run your tests in a test composition for full playback of your test suite.