【问题标题】:TestNG -Process finished with exit code 0TestNG - 进程以退出代码 0 结束
【发布时间】:2015-05-23 12:09:28
【问题描述】:

我正在使用Testng,我有两个课程Util and test1

Test1 类中有 4 个简单的测试方法,只打印方法的名称。在运行testng.xml 时,它会在一秒钟内打印每个方法的预期语句,然后将其替换为错误 - 进程以退出代码 0 完成。我正在使用Intellij IDE。 任何人都可以对此提出任何建议。

代码:

class util {....}
class tets1 {
@Test
public void testmethod2(){
System.out.println("In testmethod2");
}

@Test
public void testmethod3(){
System.out.println("In testmetho3");
}

 @Test
 public void testmethod4()
 {
 System.out.println("In testmethod4");
 }

 @Test
 public void testmethod5(){
 System.out.println("In testmetho5");
 }

Testng.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >

<suite name="Suite1">
<test name="test1">
<classes>
<class name="TagPackage.Test1"/>
</classes>
</test>
</suite>    

【问题讨论】:

    标签: java unit-testing testng intellij-13


    【解决方案1】:

    这不是错误,这是 IntelliJ 中的正确行为。

    控制台正在显示每个测试的输出,消息Process finished with exit code 0 表明测试运行成功。如果测试失败,这将显示其他信息(对于 Spock,这将返回 255)。

    如果您查看控制台左侧,您应该会看到已执行的测试,或者单击树顶部的测试名称,您将看到所有控制台输出。

    【讨论】:

    • 对我来说,结果之间的差异是有时部分或全部 System.out.println cmds 没有在运行控制台中显示结果。但是感谢您解释该消息不是 ERR
    • 您的代码中没有意外出现System.exit() 吗?
    猜你喜欢
    • 2017-01-19
    • 2018-05-29
    • 2013-04-19
    • 1970-01-01
    • 2021-02-20
    • 2014-01-04
    • 2017-11-03
    • 2020-01-04
    • 1970-01-01
    相关资源
    最近更新 更多