TestNG XML report
About TestNG

TestNG is a testing framework inspired from JUnit and NUnit but introducing some new functionalities that make it more powerful and easier to use, such as annotations, flexible test configurations, support for data-driven testing, and so much more.
Common structure
In a basic TestNG report, you should find common tags depicting test suites and test cases.
To visualize the structure more clearly, let’s take a look at the diagram below.
-20241210-083312.png?inst-v=e3835335-d0be-4f4c-a82c-c62b3d80caa9)
TestNG test report structure diagram
How AgileTest would parse a TestNG report
In AgileTest, all test cases which are imported via automation feature are designated as Generic tests.
Imported Test cases differ from each other by name attributes of <class>
element and <test-method>
element parsed from the XML file. The combination of these attributes is called Test definition in AgileTest. User should find it right under the Description area of Test case tickets. The Summary of each Test case issue will be the value of name attribute.
Supported status tags
Test run status tag | Description |
---|---|
| PASSED → Test case yields the expected result. |
| FAILED → Test case returns the actual result not as expected. |
| BLOCKED → Test case is considered blocked due to a specific reason. |
| SKIPPED → Test case is skipped in the test run. |
| RETEST → Test case should be rerun again. |
| QUERY → The test case requires more details to have the final result. |
| TODO → Test case is not yet run. It’s the default status of every Test case in AgileTest. |
The priority of status tags in AgileTest is as follows:
failed > blocked > retest > skipped > query > passed (or no tag).
If multiple tags are added to a single <test>
element, the tag with the highest priority will be used as the test status in Agile Test.
Test result with attachments
AgileTest supports 2 customized structure to integrate attachments into your test reports. Users could use either one to upload test result along with evidence files.
1. Attachment element with name attribute and content inside
Element structure
<attachment name="filename"> base64 content </attachment>
Example
<test-method>
....
<attachments>
<attachment name="test.png">iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAQ0lEQVR42u3PQREAAAgDINc/9Mzg14MGZNrOAxERERERERERERERERERERERERERERERERERERERERERERERERERuVh9TJWdbWjzsQAAAABJRU5ErkJggg==</attachment>
</attachments>
</test-method>
2. Attachment element with separate name and content elements inside
Element structure
<attachment>
<name>filename</name>
<rawcontent> base64 content </rawcontent>
</attachment>
Example
<test-method>
....
<attachments>
<attachment>
<name>test.png</name>
<rawcontent>iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAQ0lEQVR42u3PQREAAAgDINc/9Mzg14MGZNrOAxERERERERERERERERERERERERERERERERERERERERERERERERERuVh9TJWdbWjzsQAAAABJRU5ErkJggg==</rawcontent>
</attachment>
</attachments>
</test-method>
Should you need any assistance or further AgileTest inquiries, please contact us here!