我正在尝试使用 TestNG,它正在 eclipse 中工作。我创建了一个测试套件并尝试从命令行运行它。
构建失败并出现错误提示
构建期间的最终输出说:
[testng] ===============================================
[testng] Suite
[testng] Total tests run: 1, Failures: 0, Skips: 1
[testng] Configuration Failures: 1, Skips: 2
[testng] ===============================================
[testng]
[testng] The tests failed.
testng-results.xml 和 index.html 没有报告任何失败。
testng-failed.xml 是这样的:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Failed suite [Default suite]">
<test name="Default test(failed)">
<classes>
<class name="ABC.test.integration.PersistUrlTests">
<methods>
<include name="springTestContextAfterTestClass"/>
<include name="springTestContextBeforeTestClass"/>
<include name="springTestContextPrepareTestInstance"/>
<include name="springTestContextAfterTestMethod"/>
<include name="checkTest"/>
</methods>
</class> <!-- ABC.test.integration.PersistUrlTests -->
</classes>
</test> <!-- Default test(failed) -->
</suite> <!-- Failed suite [Default suite] -->
测试如下:
@Test
@ContextConfiguration(locations = { "file:spring-configuration/mydb-integration-testing.xml" })
public class PersistUrlTests extends AbstractTestNGSpringContextTests {
@Autowired
protected MobiusDatabaseServiceClient mobiusDatabaseServiceClient;
@Autowired
UrlDAO urlDAO;
@Autowired
ScraperUrlDAO scraperUrlDAO;
@BeforeClass
public void init() throws Exception {
}
@Test
public void checkTest() {
GetActiveCategoriesResponse response = mobiusDatabaseServiceClient.newGetActiveCategoriesCall().call();
System.out.println(response.getCategoryList());
Assert.assertTrue(true);
}
}
套件如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite" parallel="none">
<test name="Test">
<classes>
<class name="ABC.mydatabase.test.integration.PersistUrlTests"/>
</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->
但另一方面,该文件的最后更新时间已经过去。我不确定它是否正在更新。
我不确定如何调试这些由 testNG 生成的 XML 文件,因为它们似乎彼此不同步。
应该查看哪个文件?为什么他们不支持失败的“配置”?