我開發了一個jBehave故事來測試我們的系統中實現的一些工作流程。 假設這個故事叫做customer_registration.story如何多次使用不同參數運行故事
這個故事是我們系統支持的其他一些更復雜的工作流程的起點。 那些更復雜的工作流程也被不同的故事所覆蓋。 比方說,我們有我們的工作比較複雜的一個由customer_login.story覆蓋流動
所以customer_login.story看起來像某種方式如下:
Story: Customer Login
Narrative:
In order to access ABC application
As a registered customer
I want to login into the application
Scenario: Successfully login into the application
GivenStories: customer_registration.story
Given I am at the login page
When I type a valid password
Then I am able to see the application main menu
所有作品完美,我很高興接着就,隨即。
3.上面第1點(客戶註冊)的故事是我需要在不同的數據集上運行的。 假設我們的系統支持國際化,我們需要檢查客戶註冊的故事運行OK支持所有支持的語言,假設我們要測試我們的客戶註冊工程OK和en-gb和zh-tw
所以我需要實施multi_language_customer_registration.story將看起來類似的東西:
Story: Multi language customer registration
Narrative:
In order to access ABC application
As a potential customer
I want to register for using the application
Scenario: Successfully customer registration using different supported languages
GivenStories: customer_registration.story
Then some clean up step so the customer registration story can run again
Examples:
|language|
|en-gb |
|zh-tw |
,我怎麼能做到這一點任何想法? 請注意,下面的東西不是一個選項,因爲我需要運行之間的清理步驟。
GivenStories: customer_registration.story#{0},customer_registration.story#{1}
移動客戶註冊故事中的清理步驟也不是一個選項,因爲登錄故事將停止工作。
在此先感謝。
P.S.正如你在現實中猜測的那樣,我們創建的故事更加複雜,重構它們並不是一件容易的事情,但我很樂意爲此獲得真正的收益。
感謝您的文章,但我正在尋找一個jBehave解決方案。我們在Java方面(不是它真的很重要),在JUnit中,你也可以做很多事情。 但是,我在這裏發佈的問題是端到端測試套件的一部分。 JBehave會觸發REST和WS請求,或者按下各種網頁上的按鈕,來完成用戶和/或客戶端應用程序在現實世界中的操作。 當我說我很樂意做一些重構工作時,我並不意味着重寫超過一年的優秀工作開發所有這些場景:-) – Julian
請看https://github.com/leblancmeneses/RobustHaven.IntegrationTests而不是在Java中 - 你有完整的源代碼可以轉換爲Java。我們使用selenium和watin,可以構建一些大型複合工作流程:序列(helper.DoPastDueFlow(xx,xx,xx,xx,xx)) 。序列(...) 。序列(...)轉換。您現有的記錄方案將進入訪問者內部,該訪問者將訪問組合中的每個節點以執行工作流程。 –