简体   繁体   English

我可以使用空手道dsl将值从一个文件夹的一个功能文件传递到/ src / java / test下的另一个文件夹的另一个功能文件

[英]Can I pass values from one feature file of one folder to another feature file of another folder under /src/java/test using karate dsl

My project structure is something like this: 我的项目结构是这样的:

/src/java/test

TestRunner -> main.java
Component1 --> Admin.feature
Component2 --> Publisher.feature
Component3 --> Store.feature

I want to pass some value from Admin.feature file to Publisher.feature file. 我想将一些值从Admin.feature文件传递到Publisher.feature文件。 Is that possible? 那可能吗?

I know we can pass values from one feature file to another under the same folder, but I'm unsure if the value can be used throughout my folder structure. 我知道我们可以将值从一个功能文件传递到同一文件夹下的另一个功能文件,但是我不确定该值是否可以在整个文件夹结构中使用。

Yes, as long as you are able to read() your feature file and both the features are in the same scenario. 是的,只要您能够read()您的功能文件并且两个功能都在同一场景中即可。

Let's say you want to pass values from Admin to Publisher inside a Store feature. 假设您要将值从Admin传递到Store功能中的Publisher

Store.feature Store.feature

Scenario:
    * def getAdmin = call read('classpath:Component1/Admin.feature') {"SomeInput":"toAdmin"}
    * def getPublisher = call read('classpath:Component2/Publisher.feature') {"Admin": "#(getAdmin.response)"}

now inside your Publisher.feature you can get the admin response details in the Admin varaible 现在在Publisher.feature您可以在Admin变量中获取管理员响应的详细信息

Note: To find any file under /src/java/test directory you can prefix with classpath: as mentioned in the above example. 注意:要在/ src / java / test目录下找到任何文件,可以在上面的示例中添加classpath:作为前缀。

Lets say I have multiple scenariosinside my called feature (with tags=@scenario) and I only want to run scenario1. 可以说我在调用的功能内部有多个场景(带有标签= @ scenario),我只想运行scenario1。 Is it possible to achieve that? 有可能实现这一目标吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在一个功能中设置空手道中的全局变量以在另一功能中使用 - Setting global variables in karate from one feature to be used in another feature 空手道无法将JSON传递到功能文件 - Karate Unable to pass JSON into feature file 如何将groovy dsl脚本从一个groovy文件添加到另一个文件 - how to include groovy dsl script from one groovy file to another 将一种 DSL 转换为另一种 - Translating one DSL to another 如果使用空手道在特征文件中满足条件,如何跳过下一步 - How to skip next steps if a condition is fulfilled in a feature file using karate 空手道特征文件中的 String.split() 返回异常 - String.split() in Karate Feature File returning exceptions TeamCity Kotlin DSL:如何从位于 DSL 文件夹中的文件运行 PowerShell 脚本 - TeamCity Kotlin DSL: how to run a PowerShell script from file located in the DSL folder 如何将一个 output 从一个进程传递到 Nextflow 中的另一个进程? - How to pass the one output from one process to another process in Nextflow? 我可以在使用DSL的Fluentd的配置文件中使用点吗? - Can I use a dot in a config file of Fluentd using DSL? 如何在空手道dsl中读取和编辑json文件并将其作为请求发送 - How to read and edit a json file and send it as a request in karate dsl
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM