I haven't had a need to do this myself, but if I did I'd probably use
steps like this:
private long scenarioStartTime;
@BeforeScenario
public void startTimingScenario() {
scenarioStartTime = new Date().getTime();
}
@Then("this scenario will complete in $s seconds")
public void assertScenarioPerformance(int s) {
long now = new Date().getTime();
long scenarioSeconds = (now - scenarioStartTime) / 1000;
assertThat(scenarioSeconds, lessThanOrEqualTo(s));
}
And just toss a "And this scenario will complete in x seconds" on the
end of each scenario that I'm interested in.
Cheers,
--Aaron V.
On Thu, Oct 20, 2011 at 1:46 PM, Seth Carter <[email protected]> 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