尝试从请求中做出一些断言,该断言将作为回应 [英] Trying to do some assertion from request, which will be present in response

查看:50
本文介绍了尝试从请求中做出一些断言,该断言将作为回应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在传递请求,就像在我的功能文件中一样,我正在尝试从请求到响应做断言.

I am passing the request as in my feature file and i am trying to do assert from request to response.

我尝试过必须包含查询,但是我不确定自己做的是否正确,请您帮忙.

I have tried must contains queries but i am not sure if i am doing it correct, could you please help.

**Background:**
*  configure headers = read('classpath:merchantServiceheaders.js')

Given url MservUrl 
And path '/spapis/rest/sp-ms-engine/sp/ms/v1/engine/scanandredact'

方案纲要:ACH低价值支付陷阱服务摘要

] } ***

我想做的是断言我在请求中所拥有的内容,以回应我将要返回的内容.

What i would like to do is assert what i have in my request to what i will get back in response.

由于我在请求中传递了主题,因此应该在响应中出现相同的主题

Since i am passing subject in request the same subject should be present in response

推荐答案

可能在0.9.3中:

Possible in 0.9.3: https://github.com/intuit/karate#scenario-outline-enhancements

首先将Examples:列标题更改为data!

And request data
When method post
Then status 200 
And match response contains data 

在0.9.2和更早版本中,示例:列标题为data

In 0.9.2 and earlier, with the Examples: column header as data

* def data = <data>
And request data
When method post
Then status 200 
And match response contains data 

这篇关于尝试从请求中做出一些断言,该断言将作为回应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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