Parameters and external data source
Question ID: 107187
0
0

In UFT 12.01 when creating service test with Optional (Excluded) input parameters, if an external data source is linked, the input parameter changes to Optional (Included).

Is there a way to keep it Optional (Excluded) or a work around for running the test without providing a value in the external data source for this parameter.

Marked as spam
Posted by (Questions: 63, Answers: 1)
Asked on October 20, 2016 12:13 pm
80 views
Answers (1)
0
Private answer

Here is a solution using REST which uses the event OnBeforeExecuteStepEvent and scans the envelope for the word 'NIL' in the Departure and arrival city using the sample flight reservations sample.

Code to follow:

public void StServiceCallActivity5_OnBeforeExecuteStepEvent(object sender, STActivityBaseEventArgs args)
{
String myKeyword=''NIL'';

//////// FOR DEPARTURE CITY /////////
String myX=''/*[local-name(.)='Envelope'][1]/*[local-name(.)='Body'][1]/*[local-name(.)='GetFlights'][1]/*[local-name(.)='DepartureCity'][1]'';

XmlNode myNode =this.StServiceCallActivity5.InputEnvelope.SelectSingleNode(myX);

if ( myNode.InnerText.CompareTo((myKeyword))==0 )
{
myNode.ParentNode.RemoveChild(myNode);
}

//////// FOR ARRIVAL CITY /////////

Marked as spam
Posted by (Questions: 2, Answers: 98)
Answered on October 20, 2016 12:15 pm
EyeOnTesting

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

X
Scroll to Top