commit f9f27c82a41c0483b29f3d2b7bafaff7d7cb8042
Author: Mauro Talevi <[email protected]>
AuthorDate: Sat, 4 Oct 2014 19:18:20 +0100
Commit: Mauro Talevi <[email protected]>
CommitDate: Sat, 4 Oct 2014 19:18:20 +0100
JBEHAVE-1046: Wait for running stories to start, if any are present.
diff --git
a/jbehave-core/src/main/java/org/jbehave/core/embedder/StoryManager.java
b/jbehave-core/src/main/java/org/jbehave/core/embedder/StoryManager.java
index 2414cf7..123084a 100644
--- a/jbehave-core/src/main/java/org/jbehave/core/embedder/StoryManager.java
+++ b/jbehave-core/src/main/java/org/jbehave/core/embedder/StoryManager.java
@@ -139,11 +139,16 @@ public class StoryManager {
}
public void waitUntilAllDoneOrFailed(BatchFailures failures) {
+ if ( runningStories.values().isEmpty() ) {
+ return;
+ }
boolean allDone = false;
- while (!allDone) {
+ boolean started = false;
+ while (!allDone || !started) {
allDone = true;
for (RunningStory runningStory : runningStories.values()) {
if ( runningStory.isStarted() ){
+ started = true;
Story story = runningStory.getStory();
Future<ThrowableStory> future =
runningStory.getFuture();
if (!future.isDone()) {
@@ -177,6 +182,8 @@ public class StoryManager {
}
}
}
+ } else {
+ started = false;
}
}
tickTock();