Forum Discussion

Aksingia's avatar
Aksingia
Occasional Contributor
8 years ago

Assertion and variable comparaison for a webservice

Hello,   I have a webservice which as //*:import_id_doc_stk in request part and has //*:export_id_doc_stk in response. I won't explain the processing but I'd like to compare //*:import_id_doc_stk ...
  • HKosova's avatar
    8 years ago

    The XPath Match assertion can compare a request field with a response field. Assuming the request and response belong to the same test step, and assuming there's just one element "import_id_doc_stk" in the request and one element "export_id_doc_stk" in the response, you can configure XPath Match as follows:

     

    XPath Expression:

    //*:export_id_doc_stk

     

    Expected result:

    ${${=context.currentStep.label}#Request#//*:import_id_doc_stk}

    or if #Request# does not work:

    ${${=context.currentStep.label}#RawRequest#//*:import_id_doc_stk} 

    ${...} forces the expressions to be evaluated rather than treated as literal strings.