【发布时间】:2018-03-27 16:00:08
【问题描述】:
知道为什么 TestNG 没有运行我的测试吗? 这是类代码(java):
public class main {
@Test
public static void main(String[] args) throws AWTException, InterruptedException
这是eclipse上的路径: enter image description here
这是 XML 文件:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite">
<test name="Test">
<classes>
<class name="test.main"/>
</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->
【问题讨论】:
-
您的测试代码不应该需要
main()方法,我猜想尝试使用它完全绕过了TestNG。 -
我不确定
@Test方法可以有参数。无论如何,当你的测试方法运行时,它会从哪里得到args的值?补充:他们可以,但也许你没有遵守规则,testng.org/doc/documentation-main.html#test-methods(见 5.6)。 -
从 main 方法中删除字符串数组参数并尝试。它可能有效
标签: java eclipse selenium automation testng