Hi Seth,

updated example to work with multiple threads.

cd examples/threads
mvn clean install -Dstory.timeout.in.secs=3

Note that the steps method uses AtomicInteger

http://jira.codehaus.org/browse/JBEHAVE-623

So you need to build latest snapshot. We'll release 3.5.2 in next few days.

Cheers

On 24/10/2011 15:25, Seth Carter wrote:
Using the threads example in /jbehave-core/examples/threads to learn
more about the storyTimeoutInSecs I added
<storyTimeoutInSecs>5</storyTimeoutInSecs>
to properties stanza and
<storyTimeoutInSecs>${storyTimeoutInSecs}</storyTimeoutInSecs>
to the jbehave-maven-plugin configuration in
jbehave-core/examples/threads/pom.xml

I also made Tom count to 15 so his thread would run longer than Huck's

but I get strange results.  Only Huck's story gets timeout warning and
Tom seemingly stops counting when Huck does.

Console output:
[INFO] Running stories using embedder
[INFO] Found class names: [org.jbehave.examples.threads.ThreadsStories]
[INFO] Running embeddable org.jbehave.examples.threads.ThreadsStories
[INFO] Processing system properties {}
[INFO] Using 2 threads
[INFO] Using executor service
java.util.concurrent.ThreadPoolExecutor@1df5f59[Running, pool size = 0,
active threads = 0, queued tasks = 0, completed tasks = 0]
[INFO] Running story org/jbehave/examples/threads/stories/a_long.story
[INFO] Running story org/jbehave/examples/threads/stories/another_long.story
Huck says 0 Mississippi
Tom says 0 Mississippi
Huck says 1 Mississippi
Tom says 1 Mississippi
Huck says 2 Mississippi
Tom says 2 Mississippi
Huck says 3 Mississippi
Tom says 3 Mississippi
Huck says 4 Mississippi
Tom says 4 Mississippi
Huck says 5 Mississippi
Tom says 5 Mississippi
Huck says 6 Mississippi
Tom says 6 Mississippi
Huck says 7 Mississippi
Tom says 7 Mississippi
Huck says 8 Mississippi
Tom says 8 Mississippi
Huck says 9 Mississippi
Tom says 9 Mississippi
(org/jbehave/examples/threads/stories/a_long.story)
(org/jbehave/examples/threads/stories/another_long.story)
Scenario: A very long scenario
Scenario: A very long scenario
When Tom counts to 15 Mississippi
When Huck counts to 10 Mississippi

[WARNING] Story org/jbehave/examples/threads/stories/a_long.story has
timed out after 6 seconds
(AfterStories)

Would someone else confirm this behavior?
Thanks,
Seth

On Friday, October 21, 2011, Seth Carter
<[email protected]
<mailto:[email protected]>> wrote:
 > Excellent, thanks.  First I'll investigate the native story level
timeout for the easy win and post back if/when I can get a finer grained
approach working similar to the junitperf options.
 > Thanks again.
 > Seth
 >
 > On Friday, October 21, 2011, Mauro Talevi
<[email protected]
<mailto:[email protected]>> wrote:
 >> And the time each story takes to complete is reported in the reports
view.
 >>
 >> If on the other hand you want to have some more fine grained
stop-watch metrics (e.g. at scenario level) you'll need to implement
them yourself.
 >>
 >> On Fri Oct 21 11:02:14 2011, Mauro Talevi wrote:
 >>>
 >>> Hi Seth,
 >>>
 >>> JBehave already supports the concept of timeout for a given story.
You can specify the timeout in secs via the Embedder, Maven or Ant.
 >>>
 >>> And yes, JBehave can certainly be used for performance testing.
 >>>
 >>> Cheers
 >>>
 >>> On 21/10/2011 02:16, Seth Carter wrote:
 >>>>
 >>>> in another life I worked on a python based test framework using
pyunit and pyunitperf and was able to add a test and run it normally for
pass/fail based on business logic, if that test lent itself nicely for
performance I could run it (same test) inside a timed wrapper for
pass/fail based on a time limit. Further, I could supply tolerance time,
number of users, number of iterations/user, and a delay between
iterations/test/user. I'm now working with a series of java apps and (of
course) jbehave and have come to the same question from a developer:
 >>>> "Well what if I want to make sure my test(scenario) runs in under
x seconds?"
 >>>> This reminded me of the problem solved with pyUnitPerf. I liked
the idea of writing the test once with the possibility to time, or load
and time it. pyUnitPerf is a port of jUnitPerf so I figured the same is
possible with a jbehave test as it is based on junit?
 >>>>
 >>>> The real problem is my java skills are laughable (but improving),
I'm wondering if anyone has fooled around with this?
 >>>> Also wondering if there is some performance module in jbehave that
I have completely missed.
 >>>> Thanks,
 >>>> Seth
 >>>
 >>>
 >>> ---------------------------------------------------------------------
 >>> 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
 >>
 >>
 >>



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to