的要求是創建三個用戶,然後創建一個模板/文件中添加這三個用戶是否可以寫兩個不同的集情景大綱例
我可以在一個場景輪廓實現這一目標?
Scenario Outline: Create users and load to a template
Given I create an user <username>
And the password as <password>
And the description as <description>
Example:
| username | password | description |
| user1 | pwd1 | user1creation |
| user2 | pwd2 | user2creation |
| user3 | pwd3 | user3creation |
When user create a template ??????
任何人都可以建議如何編寫模板創建步驟並傳遞用戶名作爲參數嗎?
您可以編寫多個示例表(U已放入示例中更改它)。在這種情況下,對多個表格的要求是什麼,似乎一張表格就足夠了。運行黃瓜時,您可以使用dryRun = true,缺失的步驟定義將自動打印在控制檯中。複製並粘貼這些。當你想要真正運行時移除dryRun。 – Grasshopper
當我運行這個場景時,模板也會創建3次,但是需求是創建3個用戶,然後只創建一個模板並將用戶名輸入到這個模板 – sajida
如果您使用Java設置了一個私有靜態標誌變量,並且在步驟定義類中將其設置爲false。在該模板創建的任何步驟中,檢查標誌值,如果爲false,則創建並設置爲true。如果爲true,則繞過模板創建。如果不使用Java,則使用適合您的語言的全局變量。 – Grasshopper