I have a problem with JUnit4 and it’s @Test(timeout=xxx) annotation. For example, two tests with same body, different name. None of them uses any global variables which can be initialized.
When I run tests it has totally different execution time (First test 0,811s, second 0,143).
It’s very important for me to get similar results. Is there any way to resolve/workaround this problem ?
It is probable that the first test is reported as having taken longer because this includes the setup time JUnit takes to initialize the class. If you have 2 tests that need to run in approximitely the same amount of time, consider adding a third test before the other two just to get the init stuff out of the way.
Let me know if this works, am curious.