[英]Karate : Passing variable from one feature file to another as a query parameter
I'm trying to execute a feature file and need which takes a query parameter from another feature.我正在尝试执行一个功能文件,并且需要从另一个功能中获取查询参数。
Here is the feature files : 1. This file call two feature files.下面是特征文件: 1. 这个文件调用了两个特征文件。 First feature file add a record in the database and returns json response.第一个特征文件在数据库中添加一条记录并返回 json 响应。 I have to use a property from the response and have to pass to another feature.我必须使用响应中的属性,并且必须传递给另一个功能。 Please find below for the features files.请在下面找到功能文件。
Feature: Background:特点: 背景:
Scenario: Given call read('test_add.feature')场景:给定调用 read('test_add.feature')
And def query1 = response.name
Given call read('test_get.feature') {'**query**' : #query1}
feature name - test_get.feature Feature: Add a new Nat bundle device功能名称 - test_get.feature 功能:添加新的 Nat 捆绑设备
Background:背景:
url baseUrlWithContext url baseUrlWithContext
def headers = { 'Content-Type': 'application/json' } def headers = {'内容类型':'应用程序/json'}
Scenario: Addition场景:添加
Given headers headers给定标题标题
And path '/test'和路径'/test'
And params query和参数查询
When method get当方法得到
Then status 200然后状态 200
Error : com.intuit.karate.exception.KarateException:错误:com.intuit.karate.exception.KarateException:
cannot convert to map: query无法转换为地图:查询
Instead of And params query
而不是And params query
Try this:尝试这个:
And param query = query
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.