java TestNG -进程已完成,退出代码为 0

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29160502/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-02 14:46:36  来源:igfitidea点击:

TestNG -Process finished with exit code 0

javaunit-testingtestngintellij-13

提问by user3712016

I am using Testng, I have two classes Util and test1.

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

I have 4 simple test methods in Test1class printing just the name of method. On running the testng.xml, it prints the expected statements from each method for a sec and then replaces it with error - Process finished with exit code 0. I am using Intellij IDE. Could anyone suggest anything on this.

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

Code :

代码 :

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:

<?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>    

回答by tddmonkey

This isn't an error, this is the correct behaviour in IntelliJ.

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

The console is displaying the output of each test as it goes, the message Process finished with exit code 0states that the test run was successful. If a test fails this will say something else (for Spock this returns 255).

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

If you look to the left of the console you should see the tests that were executed, or clicking on the test name at the top of the tree you will see all of the console output.

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