It is useful to test situations where invalid data is sent to your service, for example, sending a string when your service expects an integer.
- Select the Test Suite: Functional Tests node, then click the Add Test Suite toolbar button.
- Choose Empty from the Add Test Suite wizard and click Finish.
- Double-click the new Test Suite: Test Suite node that was added to the test suite tree.
- Name the test suite
Sending Bad Data
and click the Save toolbar button. - Expand Test Suite: getItemById Unit Tests > Test Suite: getItemByIdNegative Test and copy Test 1: getItemById.
- Paste Test 1: getItemById into the new Sending Bad Data test suite.
- Double-click the Test 1: getItemById node within the Sending Bad Data test suite.
- In the test configuration panel’s Form Input view, right-click the id element and disable (uncheck) Enforce Schema Type in the shortcut menu. This allows SOAtest to send the id element data that does not conform to the schema. In this case, the schema indicates that the id element is an int, but we'll send a string instead.
- Enter the literal string
Bad Data
as the Fixed Value for the id element, then click the Save toolbar button. - Click the Run Tests toolbar button.
- After the test completes, view the traffic by expanding the Test Suite: Sending Bad Data > Test 1: getItembyID branch and double-clicking Traffic Object > Traffic Viewer.
- Click the Traffic Viewer’s Response tab and notice that an exception is thrown and displayed in the Response traffic.
- Right-click the Test 1: getItemById node within the Sending Bad Data test suite and choose Create/Update Regression Control.
- In the Response Validation Wizard, choose Create Regression Control and click Finish.