Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space FUNCTDEV and version SOAVIRT_9.10.4_CTP_3.1.1

...

  1. Select the Test Suite: Functional Tests node (created in Creating Test Suites for Unit Tests) and click the Add Test Suite toolbar button.



  2. In the Add Test Suite wizard, click Empty, then click Finish.
  3. Double-click the new Test Suite: Test Suite node added to the test suite tree, enter Custom Scripting in the Name field in the test configuration panel, then click Save.
  4. Select the Test Suite: Custom Scripting node and click the Add test or output button.



  5. In the Add Test Wizard, select SOAP Client in the right, then click Finish. A SOAP Client tool is added to the test suite.
  6. Double-click the Test 1: SOAP Client node underneath the Test Suite: Custom Scripting node and enter Validate Price Value in the Name field in the right GUI Panel.
  7. In the WSDL tab of the test configuration panel, enter http://localhost:8080/parabank/services/store-01?wsdl in the WSDL URL field.
  8. Open the Request tab, then select getItemByTitle from the Operation drop down box.
  9. In the SOAP body tab, click getItemByTitle and enable the titleKeyword option.
  10. Choose Fixed from the drop-down menu and enter Linux as the value.
  11. Click the Save toolbar button.



  12. Right-click the Test 1: Validate Price Value node and select Add Output.
  13. In the Add Output wizard, select Response> SOAP Envelope on the left, and XML Assertor on the right, and click Finish. This tells SOAtest to chain an XML Assertor to the XML Response output of the SOAP Client.



  14. Open the Configuration tab within the XML Assertor test configuration panel, then click the Add button.
  15. In the Select Assertion dialog, expand the Value Assertion node, select Custom Assertion, and click the Next button.



    The Custom Assertion dialog then displays a tree view of the XML message from which you can select a single value to enforce.
  16. Select the price element in the XML tree view and click the Finish button.



    The test configuration tab will now be populated with a Custom Assertion.
  17. Select Jython from the Language drop-down menu.
  18. Enter the following script, which ensures that the price value is even, in the Text field of the test configuration tab:

    Code Block
    def checkPrice(input, context):
    	price = float(input)
    	if price % 2 == 0:
    		return 1
    	else:
    		return 0
  19. Select checkPrice() from the Method drop-down menu.



  20. Click the Save toolbar button.
  21. Select the Test 1 node and click the Test button. Notice that the test fails. If you double-click the test’s Traffic Viewer node, you will see that the price of the Linux book is an odd number, causing the test to fail.

...