簡體   English   中英

如何使用Cucumber-jvm將一個功能運行到一個Junit測試中

[英]How to run more then one feature into one junit test with cucumber-jvm

我有2個具有不同標簽(@ tag_1和@ tag_2)的功能文件。 另外,我有junit測試類:

@RunWith(Cucumber.class)
@CucumberOptions(features = path/to/features, tags = {"@tag_1", "@tag_2"})

但是,如果我運行junit test,則在控制台中會看到以下內容:

0個場景
0步
[path / to / features]的所有功能均未與過濾器匹配:[@ tag_1,@ tag_2]

但是在功能中,我會在功能詞之前看到這些標簽

怎么了?

如果您看看黃瓜標簽的規格

  • 以逗號分隔的標簽進行或運算
  • 在單獨的標記中傳遞的標記-AND標記

轉換為cucumber-jvm:

  • 如果要執行OR (運行帶有@ tag1或@ tag2注釋的功能)

    @CucumberOptions(功能=路徑/至/功能,標簽= {“ @ tag_1,@ tag_2”})

  • 如果要執行AND操作 (運行帶有@ tag1和@ tag2注釋的功能)

    @CucumberOptions(功能=路徑/到/功能,標簽= {“ @ tag_1”,“ @ tag_2”})

希望能幫助到你。

暫無
暫無

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

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