After adding a data source to a test suite, the data source values can be used in conjunction with SOAtest tools to further extend the functionality of the test suite. Data sources can be used to parameterize values in tools such as SOAP Client, Messaging Client, Browser Playback Tool, DB Tool, Diff Tool, and so on. The SOAP Client and Messaging Client tools can be configured to send data source values as part of a request to the server. The Diff tool can then be configured to compare the responses to another set of values in the data source.
For example, consider the functional testing of a service that receives the names of U.S. capital cities and returns the names of corresponding states. In this case, a data source with two columns of differing values—the first column containing cities as values, and the second column containing states as values—would be added to the test suite. The SOAP Client tool could be configured to send requests that draw inputs from the first column. The Diff tool would then be configured to compare the actual responses to the inputs in the second column. Using the SOAP Client and Diff tools in this way is a very powerful option in functional testing since each value in each row of the data source would be cycled through and checked.
Want to dynamically specify different data sources for the same tool? You can achieve this with data groups. See Configuring a Data Group Data Source that Lets You Switch Between Multiple Data Sources for details.
It is important to understand how the test Execution Options will affect Data Source iteration. For more information on Test Execution settings, see Configuring Test Suite Properties - Test Flow Logic, Variables, etc.. The following Execution Options will affect Data Source Iteration:
For example, if a Test Suite contains Test A and Test B that both use a Data Source with three rows, the following execution patterns would occur:
If an XML Data Bank is used to pass values between test cases in a Test Suite, this will automatically put the Test Suite in "Scenario Mode" regardless of whether Individually Runnable is selected. The Data Source iteration will behave as if Individually Runnable is not selected. For more information on using an XML Data Bank see XML Data Bank.
To configure the SOAP Client and Diff tools to send and compare data source values:
You can now perform a functional test by selecting the SOAP Client node and clicking Run Tests on the tool bar. The results will appear in the right GUI panel.
SOAtest also allows you to map hierarchical data structure in data sources.
Suppose that you have a web service that collects information to construct family trees. The information sent looks like the following:
<ns1:People xmlns:ns1="http://www.example.org/ParentChildGrandChild">
<ns1:Person>
<ns1:Name>GrandPa</ns1:Name>
<ns1:Age>85</ns1:Age>
<ns1:Child>
<ns1:Name>Daddy</ns1:Name>
<ns1:Age>55</ns1:Age>
<ns1:Child>
<ns1:Name>FirstSon</ns1:Name>
<ns1:Age>25</ns1:Age>
</ns1:Child>
<ns1:Child>
<ns1:Name>SecondSon</ns1:Name>
<ns1:Age>22</ns1:Age>
</ns1:Child>
</ns1:Child>
</ns1:Person> </ns1:People> |
It represents a family tree as follows:
How do you set up an “Array Data Source” that can be used to vary the number of children and grandchildren in the XML? First, you setup the data source, then you use it to parameterize the form input as described in the following sections.
Suppose we want to send family tree information for the following two families.
To set up the data source for this scenario:
The next step to varying the number of children and grandchildren in the XML is to parameterize the form input as follows:
ArrayDataSource.tst.http://soatest.parasoft.com/ParentChildGrandChild.xsdhttp://ws1.parasoft.com:8080/examples/servlets/EchoIn the Traffic Viewer, the XML should reflect the family information in the data source.