SoapUI-如何将属性传输与POST请求一起使用 [英] SoapUI - How to use Property Transfer with POST request

查看:285
本文介绍了SoapUI-如何将属性传输与POST请求一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始将SoapUI评估为我的测试套件,但是Property Transfer确实使我退缩.我已经阅读了很多有关它的文章,但是找不到适合我的情况的方法.

I am starting to evaluate SoapUI as my test suite, but the Property Transfer thing is really holding me back. I've read a lot of articles about it, but I could not find a way to make it work in my case.

我的来源是POST请求.此POST请求返回了一个JSON.我需要将此JSON值之一传递给下一个测试.

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

我的回答是:

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

我需要获取<access_token>并将其作为参数传递给下一个测试.

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

我应该在SOURCE和TARGET框中写些什么才能使它起作用?为什么这么复杂,为什么没有简单易懂的教程呢? :(

What should I write in the SOURCE and TARGET boxes to get this to work? Why is it so complicated and why there is no easy to understand tutorial about this? :(

推荐答案

对我来说,最简单的方法是使用属性:响应"和路径语言:JSONPath".

The simplest way to do that, for me, was using "Property: Response" and "Path Language: JSONPath".

然后将我使用的源代码简单地用作"$ .access_token"

Then for the source I used simply "$.access_token"

对于目标,我在项目中定义了一个名为access_token的属性.

For the Target, I defined a Property called access_token in the Project.

这篇关于SoapUI-如何将属性传输与POST请求一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆