调用具有多个参数的特征文件 [英] Calling feature file with multiple arguments

查看:68
本文介绍了调用具有多个参数的特征文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想调用一个具有3个参数的功能文件,第一个参数创建具有该名称的实体,其余两个2个参数来验证创建的实体具有特定字段的所需值. 我如何在空手道中做到这一点?

I want to call a feature file with 3 arguments, 1 st argument to create entity with that name and rest of 2 arguments to verify created entity has desired values for particular fields. How can I do this in Karate??

推荐答案

您可以将所有输入保留在一个JSON中,然后按照本文档中的说明将其传递给您的功能.

You can keep all the input in one JSON and pass it to your feature as mentioned in this documentation.

调用其他功能

Feature: main 
 Scenario: 
  * def result = call read('myfeature.feature') { createEntity: 'value', arg1: 'arg1Value',arg2: 'arg2Value'} 

在调用的功能内部,您可以通过在JSON中使用的键直接访问值.

Inside your called feature you can directly access the values by the key that you used in your JSON.

这篇关于调用具有多个参数的特征文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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