对于 Intellij 上的相同测试,每次 TestNG 控制台输出都不同

TestNG console output is different every time for same tests on Intellij

所以基本上我是 运行 Intellij CE 14.1.4 上的一个简单测试,试图在控制台上显示一些消息,但几乎每次 time.It 的驾驶我都会得到不同的结果我疯了...这不会发生在 eclipse though.Here 是代码:

    package TestngFiles;
        import org.testng.annotations.BeforeMethod;
        import org.testng.annotations.Test;
public class Annot {
    @BeforeMethod
    public void userIdGeneratio(){
        System.out.println("User id Generated");
    }
    @Test
    public void aopenningBrowser(){
        System.out.println("test");
    }
    @Test
    public void flightBooking(){
        System.out.println("Flight Booking");
    }
}

下面是一些结果:

User id Generated
User id Generated
Flight Booking

Process finished with exit code 0



User id Generated
test
User id Generated
Flight Booking

Process finished with exit code 0




User id Generated

Process finished with exit code 0

这是 IntelliJ TestNG 插件的已知问题。 IntelliJ 本身是一个很棒的工具,但是这个插件不合标准。它有错误并且没有引用最新的 TestNG xml 架构文档。好久没维护了,我写过:

http://automatictester.co.uk/2014/03/16/intellij-idea-and-outdated-testng-j-plugin/

您不应依赖 IntelliJ 中的 TestNG 控制台输出,它处于永久怪癖模式。一次输出会在这里,另一次不会。你对此无能为力。忍受它。