Now that we have a unit test created that tests a single input value, the next step is to add a data source. Adding a data source will allow you to test multiple input values with a single test case.
- Right-click the root test suite node Test Suite: Functional Tests and choose Add New > Data Source.
- Choose Excel in the New Project Data Source wizard and click Finish.
- In the Data Source configuration panel, complete the following:
- Enter
Books
in the Name field. - Click the File System button to navigate to and select the Books.xls file that is included in the SOAtest
examples/datasources
directory. - Click Save.
- Click Show Columns to display the column names from the Excel Spreadsheet.
- In the Test Case Explorer, double-click the Test 1: getItemByTitle node from the previous exercise.
- Click the Request tab. You should see Books already selected from the Data Source drop-down menu that is now present in the test configuration panel.
- From the titleKeyword drop-down menus at the bottom of the tool configuration panel, select Parameterized and Keywords and then click the Save toolbar button.
- Click the Run Tests toolbar button and notice the error messages that appear in the Quality Tasks view. The test ran one time for each row in the Keywords column but failed due to the XML Assertor we created previously. Now we need to update our regression control.
- Right-click the Response SOAP Envelope > XML Assertor node and choose Delete.
- Right-click the Test 1: getItemByTitle node and choose Create/Update Regression Control.
- In the Response Validation wizard, expand Update Regression Controls, choose Update All Controls, and click Finish.
- Select the Test 1: getItemByTitle node and click the Run Tests toolbar button. SOAtest adds new regression controls for each test run. In this case, four regression controls are added, one for each data source row.
- Double-click the Traffic Object > Traffic Viewer node beneath the Test 1: getItemByTitle node and notice that the test ran four times, once for each keyword value in the Keyword column.