Hello,
Using JUnitStories and running stories as paths, I am trying to use a single
java class, with two threads, to kick off two versions of the same test in
parallel with different SeleniumConfigurations per version of the Story.
The goal is parallelism with different browsers (say ie and firefox), against
Sauce Labs (has anyone done this), using the JBehave framework to implement
that parallelism (as opposed to JUnit, sureFire, etc, and avoiding multiple
files as embeddable for the same story, referencing different browsers).
Eventually, I would like to run these as JUnit tests, with Bamboo, against
Sauce Labs (using the Sauce for Bamboo plugin).
I have managed to create code to manage the different configurations, and to
add the same StoryPath to StoryPaths twice, and even created my own "run"
method to the story twice with "enqueueStory", but I cannot get the two stories
to run in Parallel, no matter what, only one story runs.
The problem is that once everything is enqueued, I call runStoriesAsPaths (not
sure what other call I could do, other than write my own runStoriesAsPaths, but
I don't want to stray from the framework now or in the future), which creates a
single configuration and connects and executes via runBeforeOrAfterStories.
The Code in question here is:
public void runStoriesAsPaths(List<String> storyPaths) {
processSystemProperties();
final EmbedderControls embedderControls = embedderControls();
if (embedderControls.skip()) {
embedderMonitor.storiesSkipped(storyPaths);
return;
}
Configuration configuration = configuration();
InjectableStepsFactory stepsFactory = stepsFactory();
List<CandidateSteps> candidateSteps =
stepsFactory.createCandidateSteps();
State beforeStories =
storyRunner.runBeforeOrAfterStories(configuration, candidateSteps,
Stage.BEFORE);
... more
Can anyone point in the right direction or give me some advice as to how to run
two stories with separate configuration from one originating, JUnit compatible,
Java class?
My run method is below.
Thanks.
David
@Override
public void run() {
int numThreads = Integer.parseInt(runtimeEnv.CONCURRENT_TESTS);
List<String> storyPaths = storyPaths();
Embedder embedder = configuredEmbedder();
Configuration configuration;
List<CandidateSteps> candidateSteps;
for (int thread = 0; thread < numThreads; thread++){
BatchFailures batchFailures = new BatchFailures();
MetaFilter filter = new MetaFilter();
List<Future><ThrowableStory>> futures = new
ArrayList<Future><ThrowableStory>>();
configuration = seleniumConfigList.get(thread);
candidateSteps = candidateStepsList.get(thread);
embedder.useConfiguration(configuration);
embedder.useCandidateSteps(candidateSteps);
for (String storyPath : storyPaths) {
embedder.enqueueStory(batchFailures, filter, futures,
storyPath, embedder.storyRunner().storyOfPath(configuration, storyPath));
}
}
embedder.runStoriesAsPaths(storyPaths);
}
The information contained in this email message and its attachments is intended
only for the private and confidential use of the recipient(s) named above,
unless the sender expressly agrees otherwise. Transmission of email over the
Internet is not a secure communications medium. If you are requesting or have
requested the transmittal of personal data, as defined in applicable privacy
laws by means of email or in an attachment to email, you must select a more
secure alternate means of transmittal that supports your obligations to protect
such personal data. If the reader of this message is not the intended recipient
and/or you have received this email in error, you must take no action based on
the information in this email and you are hereby notified that any
dissemination, misuse or copying or disclosure of this communication is
strictly prohibited. If you have received this communication in error, please
notify us immediately by email and delete the original message.