Mauro,

I realize this, and I am way beyond this.  I have successfully run tests, with 
a single configuration per story, as embeddables and as paths, against Sauce 
Labs.

What I cannot do, which is beyond any of the examples or tutorials (I believe) 
on multi-threading, in run multiple stories (actually the same story twice) as 
paths with different configurations, against Sauce Labs, using multiple threads 
(in Parallel).  The Etsy.com tutorial uses WebQueue, but I am running my tests 
from maven/bamboo, without any user interaction.

Does my problem make sense, or am I just missing something obvious?  Any help 
you, or anyone else could provide would be extremely helpful.

Thanks.
David

P.S. - My backup plan is to run as embeddable and have two wrapper files per 
browser config, and have the class recognize how to construct its config based 
upon its name, i.e. - :

MyTestIE.java
MyTestFIREFOX.java

I think this is sloppy and cumbersome and wish to avoid it, having one class 
that can run in parallel as IE or FIREFOX, against Sauce Labs:

MyTest.java (only)

From: Mauro Talevi [mailto:[email protected]]
Sent: Thursday, June 30, 2011 11:11 AM
To: [email protected]
Subject: Re: [jbehave-user] separate configuration per Story per Thread

Hi David,

multi-threading and integration with SauceLabs is already supported.

http://jbehave.org/reference/web/stable/using-sauce-labs.html

Cheers

On 30/06/2011 16:58, Alves, David wrote:
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.

Reply via email to