试图从请求中做一些断言,这将在响应中出现 [英] Trying to do some assertion from request, which will be present in response

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

问题描述

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

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

我尝试过 must 包含查询,但我不确定我是否做对了,请您帮忙.

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: https://github.com/intuit/karate#scenario-outline-enhancements

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

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

First change the Examples: column header to 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天全站免登陆