簡體   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

我的項目結構是這樣的:

/src/java/test

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

我想將一些值從Admin.feature文件傳遞到Publisher.feature文件。 那可能嗎?

我知道我們可以將值從一個功能文件傳遞到同一文件夾下的另一個功能文件,但是我不確定該值是否可以在整個文件夾結構中使用。

是的,只要您能夠read()您的功能文件並且兩個功能都在同一場景中即可。

假設您要將值從Admin傳遞到Store功能中的Publisher

Store.feature

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

現在在Publisher.feature您可以在Admin變量中獲取管理員響應的詳細信息

注意:要在/ src / java / test目錄下找到任何文件,可以在上面的示例中添加classpath:作為前綴。

可以說我在調用的功能內部有多個場景(帶有標簽= @ scenario),我只想運行scenario1。 有可能實現這一目標嗎?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM