'Configuration failures resulting into Test skip in TestNG with no information in XMLs
I am experimenting with TestNG and it is working from eclipse. I created a test suite and trying to run it from command line.
Build fails with error saying
Final output during build says:
[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 and index.html don't have any failures reported.
testng-failed.xml is like this:
<?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 looks as follows:
@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);
}
}
Suite looks as follows:
<?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 -->
But on the other hand, last updated time for this file is in past. I am not sure if it is getting updated or not.
I am not sure how to debug these XML files generated by testNG as they appear to be out of sync to each other.
Which file should exactly be looked at? And why are they not supporting to what "configuration" failed?
Solution 1:[1]
Did you assign test listeners to your test?
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Group D - Using variables" parallel="false" preserve-order="true">
<listeners>
<listener class-name="com.reportng.JUnitXMLReporter"/>
</listeners>
The test listener is catching all the failures and skipped steps / tests.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Tal Angel |
