[英]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.