[英]TestNg xml showing no error- but while running it gives Total tests run: 0
I have created a class file to print a message. 我创建了一个类文件来打印消息。 I also configured TestNG xml to execute the class.
我还配置了TestNG xml以执行该类。 Below is the contents of the XML file:
以下是XML文件的内容:
<?xml version="1.0" encoding="UTF-8"?>
<suite name="Sample test Suite">
<test name="Sample test">
<classes>
<class name="signIn.MainMenu" />
</classes>
</test>
</suite>
Here is my source code of MainMenu.java: 这是我的MainMenu.java源代码:
package signIn;
public class MainMenu {
public static void main(String args[]){
System.out.println("message");
}
}
Can someone help please? 有人可以帮忙吗?
You need to define a Test via annotations first, 您需要先通过注释定义一个测试,
so try this source instead: 因此,请尝试使用以下来源:
import org.testng.annotations.Test;
public class MainMenu {
@Test
public void test(){
System.out.println("message");
}
}
and most important advice of all: 最重要的建议:
READ a tutorial on how to test with testNG!! 阅读有关如何使用testNG进行测试的教程!!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.