From: SourceForge.net <no...@so...> - 2009-12-01 02:20:27
|
Feature Requests item #1687449, was opened at 2007-03-24 15:59 Message generated for change (Comment added) made by sf-robot You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=365278&aid=1687449&group_id=15278 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Closed Resolution: None Priority: 5 Private: No Submitted By: Tom Roche (tlroche) Assigned to: Nobody/Anonymous (nobody) Summary: allow non-constant arguments to timeout Initial Comment: http://tech.groups.yahoo.com/group/junit/message/19139 >> 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. http://tech.groups.yahoo.com/group/junit/message/19140 > 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 ---------------------------------------------------------------------- >Comment By: SourceForge Robot (sf-robot) Date: 2009-12-01 02:20 Message: This Tracker item was closed automatically by the system. It was previously set to a Pending status, and the original submitter did not respond within 14 days (the time period specified by the administrator of this Tracker). ---------------------------------------------------------------------- Comment By: David Saff (dsaff) Date: 2009-11-16 17:52 Message: This tracker is being shut down. Please move this item to http://github.com/KentBeck/junit/issues ---------------------------------------------------------------------- Comment By: Mahmood Ali (mali999) Date: 2008-07-18 23:10 Message: Logged In: YES user_id=2152267 Originator: NO This is not possible. The timeout value needs to be a compile-time constant expression, like any other annotation value (JLS 9.7, 15.28). Java specification disallows: @Test(timeout=getMaxElapsedTime()) ... but allows: final int MAX_ELAPSED_TIME = 1; @Test(timeout=MAX_ELAPSED_TIME) ... ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=365278&aid=1687449&group_id=15278 |