我是JBheave和Hive框架的新手。@BeforeScenario/@AfterScenario通過使用給定的測試故事中的特定方案
在探索Q &一個倉庫,我碰巧看到正確的答案的一個問題之一下列短語 -
這是我見過的 - 和數據對象應該使用@ BeforeScenario/@ AfterScenario方法設置/清除 。
目前我正在編寫測試故事的過程。然而,沒有進一步進入步驟。
從JBehave產品網站,我得到以下樣本測試故事。我有問題,考慮從Q & StackOverFlow的回購中插入的短語。
A story is a collection of scenarios
Narrative:
In order to communicate effectively to the business some functionality
As a development team
I want to use Behaviour-Driven Development
Lifecycle:
Before:
Given a step that is executed before each scenario
After:
Outcome: ANY
Given a step that is executed after each scenario regardless of outcome
Outcome: SUCCESS
Given a step that is executed after each successful scenario
Outcome: FAILURE
Given a step that is executed after each failed scenario
Scenario: A scenario is a collection of executable steps of different type
Given step represents a precondition to an event
When step represents the occurrence of the event
Then step represents the outcome of the event
Scenario: Another scenario exploring different combination of events
Given a [precondition]
When a negative event occurs
Then a the outcome should [be-captured]
Examples:
|precondition|be-captured|
|abc|be captured |
|xyz|not be captured|
我可以看到,就像@ BeforeScenario/@ AfterScenario在這裏一樣。
我在這裏有問題。是否可以在測試故事中將Given
前後寫入特定的Scenario:
。
而且Scenario:
輸出在測試故事中是連續的Scenario:
的。
謝謝你的回答。然而在我的情況下,我的測試故事'then'子句可能會變得非常複雜,有幾個'和'子句以及約束條件。我需要將它作爲參數傳遞給下一個場景或一些場景。會有辦法嗎? –
請詳細解釋您的具體情況,最好是作爲一個新問題 - 您想要達到什麼目的? – krokodilko
如何將在故事中編寫的參數映射到使用@BeforeScenario註釋的方法? –