/// <summary>
 /// Create Body Parameter for Response API Modules for Transform Response WSE XTestStepValues
 /// </summary>
 /// <param name="apiTestStep">TestStep of API Engine</param>
 /// <param name="wseTestStep">TestStep of WSE Engine</param>
 public static void FillTransformResponse(XTestStep apiTestStep, XTestStep wseTestStep)
 {
     try {
         List <XTestStepValue> wseTestStepValues = wseTestStep
                                                   .Search(
             "=>SUBPARTS:XTestStepValue[Name==\"Transform response\"]=>SubValues[Name==\"Response transformation\"]")
                                                   .Where(x => x.DisplayedName
                                                          == "Response transformation: Save Response")
                                                   .Cast <XTestStepValue>()
                                                   .ToList();
         BodyParamHandler.CreateBodyParameterForRequestAndResponse(apiTestStep, wseTestStepValues);
     }
     catch (Exception) {
         //ignored
     }
 }
示例#2
0
        /// <summary>
        /// Handles Web service request/response data in Xml/JSON Resource specialization
        /// </summary>
        /// <param name="wseTestStep">TestStep of WSE Artifacts</param>
        /// <param name="apiTestStep">TestStep of API Engine Artifacts</param>
        /// <param name="payloadParser">Parse xml and json payload from Wse XModules and TestSteps</param>
        /// <param name="payloadSetterFactory">Create module attributes and Set values for payload in for Api artifacts </param>
        public override void HandleSpecialization(XTestStep wseTestStep,
                                                  XTestStep apiTestStep,
                                                  IPayloadParser payloadParser,
                                                  IPayloadSetterFactory payloadSetterFactory)
        {
            XModule specializationModule =
                (XModule)wseTestStep.Search(TqlToGetWseTestStepSpecializationModule)?.FirstOrDefault();

            if (specializationModule != null)
            {
                var wseTestStepValue = (XTestStepValue)wseTestStep.Search(TqlToGetWseTestStepValue)?.FirstOrDefault();
                BodyParamHandler.CreateBodyParameterForRequestAndResponse(
                    apiTestStep,
                    new List <XTestStepValue>()
                {
                    wseTestStepValue
                });
            }
            else
            {
                successor?.HandleSpecialization(wseTestStep, apiTestStep, payloadParser, payloadSetterFactory);
            }
        }