Integrating TestNG Test Results with PractiTest

When using TestNG, integrate your test automation work into PractiTest’s test management platform with ease. Integration with TestNG and PractiTest can be done via the API or by employing PractiTest’s FireCracker tool. FireCracker simplifies the process by enabling you to upload TestNG’s XML report to PractiTest, facilitating efficient management and tracking of your test automation outcomes.

Executing a Test Case with TestNG

This is an of a test in TestNG:

package com.practitest;

import org.testng.Assert;
import org.testng.Reporter;
import org.testng.annotations.Test;

public class PTDemoTest {
  @Test
  public void testLogin() {
    Reporter.log("[[PROPERTY|id=TC-1]]\n", true);
    // [..]
  }

  @Test
  public void saveBlogPost() {
    Reporter.log("[[PROPERTY|id=TC-2]]\n", true);
    // [..]
  }

  @Test
  public void deleteUser() {
    Reporter.log("[[PROPERTY|id=TC-3]]\n", false);
    // [..]
  }
} 

Create an XML Report with Playwright

TestNG automatically generates XML reports for test executions and saves them in the “test-output” directory of your project.

Example XML Output
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated by org.testng.reporters.JUnitReportReporter -->
<testsuite hostname="Pt*****" failures="0" tests="3" name="com.practitest.PTDemoTest" time="0.024" errors="0" timestamp="2024-02-20T10:00:18 IST" skipped="0">
   <testcase classname="com.practitest.PTDemoTest" name="testLogin" time="0.005" />
   <system-out><![CDATA[[[PROPERTY|id=TC-1]]]]></system-out>
   <testcase classname="com.practitest.PTDemoTest" name="saveBlogPost" time="0.016" />
   <system-out><![CDATA[[[PROPERTY|id=TC-2]]]]></system-out>
   <testcase classname="com.practitest.PTDemoTest" name="deleteUser" time="0.003" />
   <system-out><![CDATA[[[PROPERTY|id=TC-3]]]]></system-out>
</testsuite>
<!-- com.practitest.PTDemoTest -->

Uploading Playwright Test Results to PractiTest

After the XML report is generated, use the FireCracker tool to upload the test results to PractiTest. FireCracker streamlines the process by allowing you to import XML files, including JUnit and NUnit formats, and automatically submit the results to PractiTest.

To better understand how to work with FireCracker, please refer to this help page.