SoapUI - How to use property passing with a POST request

I'm starting to evaluate SoapUI as my test suite, but the thing Transferring Property really holds me back. I read a lot of articles about this, but I could not find a way to make it work in my case.

My source is a POST request. This POST request returns me JSON. I need to pass one of the values โ€‹โ€‹of this JSON for the next test.

My answer is this:

<Response xmlns="https://localhost/authorize">
    <access_token>4a00c67e</access_token>
   <refresh_token></refresh_token>
   <scope>auth</scope>
   <token_type>online</token_type>
</Response>

I need to get <access_token>and pass it to the next test as a parameter.

What should I write in the SOURCE and TARGET blocks to make this work? Why is it so complicated and why is there no simple understanding of the tutorial about this ?: (

+4
source share
5

- "Property: Response" "Path Language: JSONPath".

"$.access_token"

Target , access_token .

0

, . access_token, XPath:

declare namespace var="https://localhost/authorize";
//var:Response/var:access_token
+8

, , .

//access_token, access_token . xpath, soapUI xml .

, , <access_token> . , .

. soapUI , , .

soapUI property transfer step

SourceRequest, , aa. . PropertyTransferName ( , ). Response. , , .

, xpath, .

, .

+2

x- Source:

**//*[local-name()='access_token']**

" "

select " Use XQuery "

This should extract the text content from your access_token node.

+1
source

To pass a property, it is important to know whether the type of response (where you are passing the value from) is json or xml. If it is json, as shown in the screenshot below:

enter image description here

be sure to set the property as "ResponseAsXml" in the transfer properties window, as shown below:

enter image description here

else "Response" will do the necessary.

-1
source

Source: https://habr.com/ru/post/1530479/


All Articles