空手道:将变量从一个功能文件传递到另一个功能文件作为查询参数 [英] Karate : Passing variable from one feature file to another as a query parameter

查看:27
本文介绍了空手道:将变量从一个功能文件传递到另一个功能文件作为查询参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试执行功能文件,并且需要从另一个功能中获取查询参数的功能文件.

I'm trying to execute a feature file and need which takes a query parameter from another feature.

以下是功能文件:1.此文件调用两个功能文件.第一个功能文件在数据库中添加一条记录,并返回json响应.我必须使用响应中的属性,并且必须传递给另一个功能.请在下面找到功能文件.

Here is the feature files : 1. This file call two feature files. First feature file add a record in the database and returns json response. I have to use a property from the response and have to pass to another feature. Please find below for the features files.

功能:背景:

场景:给定调用read('test_add.feature')

Scenario: Given call read('test_add.feature')

And def query1 = response.name

Given call read('test_get.feature') {'**query**' : #query1}

  1. 功能名称-test_get.feature功能:添加新的Nat捆绑包设备

  1. feature name - test_get.feature Feature: Add a new Nat bundle device

背景:

  • url baseUrlWithContext

  • url baseUrlWithContext

def标头= {'Content-Type':'application/json'}

def headers = { 'Content-Type': 'application/json' }

场景:加法

给出标题标题

和路径'/test'

和参数查询

方法获取时

然后状态为200

错误:com.intuit.karate.exception.KarateException:

Error : com.intuit.karate.exception.KarateException:

无法转换为地图:查询

推荐答案

而不是和参数查询

尝试一下:

And param query = query

这篇关于空手道:将变量从一个功能文件传递到另一个功能文件作为查询参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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