If you run JBehave through JUnit or TestNG, you can override the JBehave class that has the @Test in it that runs the story to have a timeout. But this would require a new way to parse the story - or pre-parse it. Or use a Story class that has an annotation on the timeout.
You could also keep a Perf4J stopwatch around and assert that the total duration was under x but then the timing assertion would be part of your story and not meta. Sorry if this post seems disjointed - its been a while since I've been in the JBehave codebase so I'm not sure on all the startup parts. But if its not available out of the box (which I don't remember it being) it could be part of a custom executor that wraps the normal execution of the story. If you want timeouts per scenario then that gets much trickier - although there is an event listening framework that you could tie into as well. Brian ----- Original message ----- From: "Seth Carter" <[email protected]> To: "[email protected]" <[email protected]> Date: Thu, 20 Oct 2011 16:46:07 -0400 Subject: [jbehave-user] jbehave timed test? 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 --- Brian Repko LearnThinkCode, Inc. http://www.learnthinkcode.com email: [email protected] phone: +1 612 229 6779
