Remove config nodes from testng-reports.xml
- ALM treats beforeMethod, afterMethod, beforeClass, afterClass, setUp, tearDown etc, as a test, but actually they are not.
- ALM treats skipped tests as failed tests.
- When we use a DataProvider to pass multiple test data, ALM treats it as just one test, instead of ’n’ no. of tests.
- Remove nodes where the “is-config” attribute equals “true”. This removes things like beforeClass, afterClass, beforeMethod etc.
Remove nodes where
status = “SKIP”
- In each node, append a unique number ,,, etc. to each name attribute. This forces ALM to bring these in a separate tests, otherwise ALM will bring these in as different runs for the same test.
- This JAVA program will help you to address the issues and output the
testng-reports.xmlfile free from config-nodes, and treat each data in data provider as a test.
STEPS TO RUN YOUR PROGRAM:
Add this dependency to your pom.xml:
<!-- https://mvnrepository.com/artifact/com.sdeting.utils/test-utils --> <dependency> <groupId>com.sdeting.utils</groupId> <artifactId>test-utils</artifactId> <version>1.0.1</version> </dependency>
And add this line to your code: TestUtils.removeConfigNodesFromTestNgResultsXML("path to your input_testng-results.xml_file");
This will generate a testng-config-free-results.xml in the root dir.