-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JBEHAVE-1586 Add ability to use scenario ExamplesTable parameters in …
…Lifecycle steps
- Loading branch information
Showing
9 changed files
with
126 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
jbehave-core/src/test/java/org/jbehave/core/junit/story/LifecycleStepsStoryWithExamples.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package org.jbehave.core.junit.story; | ||
|
||
import org.jbehave.core.configuration.MostUsefulConfiguration; | ||
import org.jbehave.core.junit.JUnit4StoryRunner; | ||
import org.jbehave.core.junit.JUnitStory; | ||
import org.jbehave.core.junit.steps.ExampleSteps; | ||
import org.jbehave.core.steps.InjectableStepsFactory; | ||
import org.jbehave.core.steps.InstanceStepsFactory; | ||
import org.junit.runner.RunWith; | ||
|
||
@RunWith(JUnit4StoryRunner.class) | ||
public class LifecycleStepsStoryWithExamples extends JUnitStory { | ||
|
||
public LifecycleStepsStoryWithExamples() { | ||
useConfiguration(new MostUsefulConfiguration()); | ||
JUnit4StoryRunner.recommendedControls(configuredEmbedder()); | ||
} | ||
|
||
@Override | ||
public InjectableStepsFactory stepsFactory() { | ||
return new InstanceStepsFactory(configuration(), new ExampleSteps()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
...src/test/resources/org/jbehave/core/junit/story/lifecycle_steps_story_with_examples.story
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
Lifecycle: | ||
Before: | ||
Scope: STORY | ||
Given a variable x with value 1 | ||
Scope: SCENARIO | ||
When I multiply x by 2 | ||
When I multiply x by <scenarioMultiplier> | ||
Scope: STEP | ||
When I multiply x by 3 | ||
When I multiply x by <scenarioMultiplier> | ||
After: | ||
Scope: STEP | ||
When I multiply x by 6 | ||
When I multiply x by <scenarioMultiplier> | ||
Scope: SCENARIO | ||
Outcome: ANY | ||
When I multiply x by 7 | ||
When I multiply x by <scenarioMultiplier> | ||
Outcome: SUCCESS | ||
When I multiply x by 8 | ||
When I multiply x by <scenarioMultiplier> | ||
Scope: STORY | ||
Outcome: ANY | ||
When I multiply x by 9 | ||
Outcome: SUCCESS | ||
!-- 1 * | ||
!-- (2 * 4) * | ||
!-- (3 * 4) * 4 * (6 * 4) * | ||
!-- (7 * 4) * (8 * 4) * | ||
!-- (2 * 5) * | ||
!-- (3 * 5) * 5 * (6 * 5) * | ||
!-- (7 * 5) * (8 * 5) * | ||
!-- 9 | ||
Then x should equal 2006581248000000 | ||
|
||
Scenario: x multiplied by 5 | ||
When I multiply x by <scenarioMultiplier> | ||
Examples: | ||
| scenarioMultiplier | | ||
| 4 | | ||
| 5 | |