[英]How to use/share data between steps?
我有兩個不同的步驟,並在其中傳遞相同的變量。
方案1:
Given the user lands on the page
When user enters a unique email address
Then user is redirected to checkout
Then user places the order
方案2:
Given the user lands on the same page
When the user enters the same email address above
Then user is presented with a modal window saying you already taken this offer
是否可以使用在第二種情況下使用的相同生成的唯一電子郵件地址?
為什么不能 您可以使用任意數量的方案。 按照方案1步驟,您已經知道需要輸入的唯一電子郵件地址。 將此電子郵件地址帶到Hooks文件中,並將其存儲在Before注釋內的一個公共靜態變量中。 稍后,您可以使用該公共靜態變量將同一電子郵件用於n個場景。
如果只需要將此電子郵件用於特定方案,則將一個標簽添加到所有需要使用的方案中,並使用Before({tags:tagName})在Hooks文件中對其進行標簽。 通過這種方式,您只能將此電子郵件地址用於所有特定情況。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.