Ok, so to clarify what I wanted to do, I want to run a story and its scenarios 
simultaneously and multiple times. Let's say that I have a web service; I've 
written one story with three scenarios for it. Is there any way for me to 
execute this story so, that the story itself (and its scenarios) is ran, for 
example, 100 times using 10 different threads? From what I understood, the 
example you provided will just run the scenarios within the stories in multiple 
threads, but each story and each scenario is executed just once. 

I'm just evaluating if this is possible with JBehave, if not, then I'll stick 
to traditional integration testing for testing concurrency.


On Apr 19, 2013, at 3:36 PM, Mauro Talevi wrote:

> Yes, you can use it to kick start the execution (as you could see) but it 
> does not support the  configuration options that it comes with.
> 
> JBehave comes with its own configuration and this is not compatible with the 
> TestNG.  Keep in mind that BDD is not meant for unit testing but for 
> integration testing so the paradigms differ at times. 
> 
> On 19 Apr 2013, at 14:20, Kim Leppänen <[email protected]> wrote:
> 
>> Hmm... According to the FAQ (http://jbehave.org/reference/stable/faq.html) 
>> it should be supported, there is even a code example :-/
>> 
>> 
>> On Apr 19, 2013, at 12:59 PM, Mauro Talevi wrote:
>> 
>>> Hi 
>>> 
>>> TestNG annotations are not supported. 
>>> 
>>> Have a look at example of multi threading:
>>> 
>>> https://github.com/jbehave/jbehave-core/tree/master/examples/threads
>>> 
>>> 
>>> On 19 Apr 2013, at 08:58, Kim Leppänen <[email protected]> wrote:
>>> 
>>>> I'm trying to create a Proof-of-Concept of using JBehave and TestNG 
>>>> together. What I want to do, is to run a story simultaneously in multiple 
>>>> threads in order to test my codes thread safety.
>>>> 
>>>> I have a simple class that only does one thing, calculates modulo 7 on a 
>>>> given integer value. I've created a simple BDD test for this class. I've 
>>>> set up my BDD test as described in JBehave "Getting started" 
>>>> documentation. The only difference is, that in my JUnitStory file, instead 
>>>> of using JUnit's @Test annotation, I've used TestNG's
>>>> 
>>>> @org.testng.annotations.Test(threadPoolSize = 10, invocationCount = 100, 
>>>> timeOut = 10000)
>>>> When I run the test, everything goes fine for the first 70-90% of the 
>>>> cases, then an exception occurs and the rest of the runs fail
>>>> 
>>>> ===============================================
>>>>   Default test
>>>>   Tests run: 100, Failures: 11, Skips: 0
>>>> ===============================================
>>>> 
>>>> 
>>>> The exception that occurs is
>>>> 
>>>> 
>>>> FAILED: run
>>>> java.util.concurrent.RejectedExecutionException
>>>>   at 
>>>> java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:1774)
>>>>   at 
>>>> java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:768)
>>>>   at 
>>>> java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:656)
>>>>   at 
>>>> java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:92)
>>>>   at org.jbehave.core.embedder.StoryManager.submit(StoryManager.java:203)
>>>>   at 
>>>> org.jbehave.core.embedder.StoryManager.runningStory(StoryManager.java:138)
>>>>   at 
>>>> org.jbehave.core.embedder.StoryManager.filterRunning(StoryManager.java:122)
>>>>   at 
>>>> org.jbehave.core.embedder.StoryManager.runningStoriesAsPaths(StoryManager.java:107)
>>>>   at 
>>>> org.jbehave.core.embedder.StoryManager.performStories(StoryManager.java:93)
>>>>   at 
>>>> org.jbehave.core.embedder.StoryManager.runStories(StoryManager.java:81)
>>>> ....
>>>> 
>>>> I'm relatively new to both JBehave and TestNG, so I was wondering if this 
>>>> could be simply a configuration issue or is it actually a bug in JBehave?
>>>> 
>>>> - Kim
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe from this list, please visit:
>>>> 
>>>>   http://xircles.codehaus.org/manage_email
>>>> 
>>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>> 
>>>    http://xircles.codehaus.org/manage_email
>>> 
>>> 
>> 
>> 


Reply via email to