2

My TestNG tests are weird... sometimes they finish, but sometimes they don't, even though there is nothing random.

Most of the tests run, then nothing happens, except the TestNG result bar is green, and flickering every few seconds (as if something would happen in the background)

It's not always at the same test method.

The problem occures about every 3. run.

btw., there is no while-loop or something similar in my test classes and tested classes.

I would be really thankful if someone has a solution for my problem. Thanks, Thomas

My Tests look like

public class Test extends BaseTest{
    private static final boolean ENABLED = true;

     @Test(groups = { GROUP_UNIT }, enabled = ENABLED)
     public void valueOfInt() {
        Assert.assertEquals(StringUtils.valueOf(5), "5");
     }
}

the corresponding method:

public static String valueOf(final Object object) {
     return object != null ? object.toString() : "null";
}
juherr
  • 5,640
  • 1
  • 21
  • 63
JavaMan
  • 1,142
  • 12
  • 22
  • I figured out that the problem is occurring always at some test methods (if I enable one of those the problem occurres much more often, but also if i disable them it's not fixed), but the strange thing is that those methods are testing just really basic stuff (certainly no dependency, while loop,...) – JavaMan Jan 19 '17 at 10:38
  • also strange, when I create a @AfterSuite method, this method is already executed, even though the tests aren't finished. – JavaMan Jan 19 '17 at 10:51
  • If the TestNG result bar is green doesn't that mean that the test did finish ? Is it the flickering that makes you think it's not finished ? I don't know what IDE you use but for me the Eclipse Console view shows ` ....` in its header when the test is terminated, and until then the TestNG bar in the TestNG Result view is not green. However if you could post an example of a test it might help. – SantiBailors Jan 19 '17 at 10:56
  • It shows terminated at the console (and the small rectangle is gray) but the red Rectangle is visible (but just at the Results of running class view, right to the green test results bar) in Eclipse) and I can manually stop the execution (it says "stop the current test run" when i hover over the rectangle) It seems like it is always at the same point, because my line coverage is always the same. – JavaMan Jan 19 '17 at 11:00
  • OK, for me it's weird that in the TestNG Result View the result bar becomes green but the Stop button at its right stays red; I don't know what that indicates. In similar situations I am sometimes able to hit Ctrl+Break or Ctrl+ScrollLock and that interrupts the execution and points the editor to the line of code where it got interrupted, but it works only in some cases depending on where the execution actually is. You might give that a shot. BTW, I'm on Windows 8.1, Eclipse Neon.2 rel. 4.6.2, TestNG plugin 6.10.0.201612030230, JDK 1.8.0_92. – SantiBailors Jan 19 '17 at 11:51
  • Thomas, what's the testng version you used, I'm going to reproduce it on my local. Thanks – XuQing Tan Jan 22 '17 at 00:52
  • Ctrl+Break / Ctrl+ScrollLock did't work I'm using version 6.9.12.201607091356 – JavaMan Jan 22 '17 at 18:02

1 Answers1

0

with current versions of eclipse and testng the problem does not occur anymore

JavaMan
  • 1,142
  • 12
  • 22
  • 1
    please revise your answer with the testng eclipse plugin version you used, this might helpful for other people. thanks – XuQing Tan Apr 01 '17 at 02:34