Loading ...
Sorry, an error occurred while loading the content.

Re: [junit] parameterizing JUnit4 timeout?

Expand Messages
  • David Saff
    Tom, There s no way to do this using the built-in runners, although a custom runner could do it. If you submit a feature request to SourceForge, I d be happy
    Message 1 of 3 , Mar 24 3:32 AM
    • 0 Attachment
      Tom,

      There's no way to do this using the built-in runners, although a
      custom runner could do it. If you submit a feature request to
      SourceForge, I'd be happy to take another look at it. Thanks,

      David Saff

      On 3/24/07, Tom Roche <tlroche@...> wrote:
      >
      > I'm testing processes of varying sizes on hosts of varying capacity.
      > Accordingly I want to be able to read timeout values from Preferences.
      > With JUnitPerf and JUnit 3.x I can decorate a test like
      >
      > + public Test suite() throws FooException {
      > + Test testCase = new TestFoo("testFoo");
      > + return new TimedTest(testCase, getMaxElapsedTime(), false);
      > + }
      >
      > With JUnit 4 I'd like to be able to do something like
      >
      > - @Test(timeout=getMaxElapsedTime())
      > - public void testFoo throws FooException {
      > - ...
      > - }
      >
      > but can't. Can I accomplish the same end in JUnit 4 without too much
      > hoop-jumping? I'm thinking this should be easy and I've just been up
      > too long :-) (Feel free to reply directly to me as well as the list.)
      >
      >
      >
      >
      > Yahoo! Groups Links
      >
      >
      >
      >
    • Tom Roche
      Tom Roche Sat, 24 Mar 2007 02:04:54 -0400 ... David Saff Sat, 24 Mar 2007 06:32:59 -0400 ... Any hints you could provide would be appreciated. I d like to get
      Message 2 of 3 , Mar 24 9:08 AM
      • 0 Attachment
        Tom Roche Sat, 24 Mar 2007 02:04:54 -0400
        >> With JUnitPerf and JUnit 3.x I can decorate a test like

        >> + public Test suite() throws FooException {
        >> + Test testCase = new TestFoo("testFoo");
        >> + return new TimedTest(testCase, getMaxElapsedTime(), false);
        >> + }

        >> With JUnit 4 I'd like to be able to do something like

        >> - @Test(timeout=getMaxElapsedTime())
        >> - public void testFoo throws FooException {
        >> - ...
        >> - }

        David Saff Sat, 24 Mar 2007 06:32:59 -0400
        > There's no way to do this using the built-in runners, although a
        > custom runner could do it.

        Any hints you could provide would be appreciated. I'd like to get more
        folks in my group contributing to our test bucket, and my harness
        should be easier to use with refactorings I could do with JUnit 4.

        > If you submit a feature request to SourceForge, I'd be happy to take
        > another look at it.

        https://sourceforge.net/tracker/index.php?func=detail&aid=1687449&group_id=15278&atid=365278
      Your message has been successfully submitted and would be delivered to recipients shortly.