Define a testing method

This task describes how to select a testing method.

To define a testing method:

  1. Open the step properties: In the Step Navigator, right-click the step whose response you want to test, and select Show Arguments.

  2. Select the Output Argument node. For details, see New Web Service Call dialog box.

  3. Select a testing method and choose an expected response:

    • To perform negative testing only, select the Negative Testing check box and choose SOAP Fault as the Expected Response.

    • To accept any type of SOAP response, select the Negative Testing check box and choose Any SOAP as the Expected Response.

    • To perform positive testing only, clear the Negative Testing check box.

  4. Verify function in the script.

    In Script view, VuGen indicates the testing method with the ExpectedResponse argument. In the following example, the script performs negative testing, indicated by the SoapFault value:

    web_service_call("StepName=AddAddr_101",
            "SOAPMethod=AddrBook|AddrBookSoapPort|AddAddr",
            "ResponseParam=response",
            "Service=AddrBook",
            "ExpectedResponse=SoapFault",
            "Snapshot=t1189409011.inf",
            BEGIN_ARGUMENTS,
            END_ARGUMENTS,
            BEGIN_RESULT,
            END_RESULT,
            LAST);
    
  5. When you replay a script that results in a SOAP fault, VuGen saves the fault to a parameter called response. To check the returned value of the SOAP fault, evaluate the response output parameter using lr_xml_find.

    In the following example, lr_xml_find checks for a VersionMismatch SOAP fault and issues an output message.

    lr_xml_find("XML={response}",
                    "FastQuery=/Envelope/Body/Fault/faultString ",
                    "Value=VersionMismatch",
                    LAST);
    if (soap_fault_cnt >0) 
         lr_output_message{"A Version Mismatch SOAP Fault occurred")
    

    For more information about lr_xml_find, see the Function Reference.

Back to top