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.

  1. Select the Test Suite: Functional Tests node, then click the Add Test Suite button.

  2. Select Empty suite from the Add Test Suite wizard, then click the Finish button.

  3. Double-click the new Test Suite: Test Suite node that was added to the test suite tree.
  4. Name the test suite Sending Bad Data and click the Save toolbar button.
  5. Expand Test Suite: getItemById Unit Tests> Test Suite: getItemByIdNegative Test and copy Test 1: getItemById.

  6. Paste Test 1: getItemById into the new Sending Bad Data test suite.

  7. Double-click the Test 1: getItemById node within the Sending Bad Data test suite.

  8. In the test configuration panel’s Form Input view, right-click the id element and disable (uncheck) Enforce Schema Type from 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.

  9. Enter the literal string Bad Data as the Fixed Value for the id element, then click the Save toolbar button.

  10. Click the Test toolbar button.
  11. After the test completes, view the traffic by expanding the Test Suite: Sending Bad Data> Test 1: getItembyID branch, and then double-clicking Traffic Object> Traffic Viewer.
  12. Open the Traffic Viewer’s Response tab. Notice that an exception is thrown and displayed in the Response traffic.

  13. Right-click the Test 1: getItemById node within the Sending Bad Data test suite and select Create/Update Regression Control from the shortcut menu.
  14. In the Response Validation Wizard, select Create Regression Control, then click Finish.
  • No labels