I have some TestNG code, where I am passing a Test annotation parameter called timeOut = TESTNG_TEST_TIMEOUT
.
@Test(description = "Tests something.", groups = { "regression" },
timeOut = TESTNG_TEST_TIMEOUT, enabled = true)
And in my TestBase class I have this member:
public final static long TESTNG_TEST_TIMEOUT = TimeUnit.MINUTES.toMillis(5);
When I use the above line of code, I get a 'attribute value must be constant' error in Eclipse.
But, if I simply define the member like so, it works:
public final static long TESTNG_TEST_TIMEOUT = 300000;
Is the use of TimeUnit not a constant?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…