簡體   English   中英

如何組織黃瓜掛鈎(@Before 和@After)中的標簽

[英]How can the tags in cucumber hooks(@Before and @After) be organised

我有兩個步驟定義,包含兩種類型的標簽(填充和測試)

  1. 第一步 def -cars.ts 包含以下標簽:@populate_cars1、@cars1、@populate_cars2、@cars2。
  2. 第二步 def - clients.ts 包含以下標簽:@populate_clients1、@clients1、@populate_clients2、@clients2。

在鈎子中,我有以下定義:

-> Before("not @populate_cars1 and not @populate_cars2 and not @populate_clients1 and not @populate_clients2", function(){...}) - 按預期工作

-> After("not @cars1 and not @cars2 and not @clients1 and not @clients2", function(){...}) - 按預期工作。

我想組織如下標簽: let pop_car = "not @populate_cars1 and not @populate_cars2" let pop_client = "and not @populate_clients1 and not @populate_clients2" @Before(pop_car + pop_client, function(){...})

我為每個步驟定義了一個變量,該變量包含標簽之間的操作並連接該變量以獲取字符串。

問題是當我連接變量“pop_car + pop_client”時 -調用 @Before鈎子。

串聯變量之間需要一個空格。

嘗試:

@Before("pop_car" + " " + "pop_client")

暫無
暫無

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

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