Modify the custom Junit report name on katalon cloud analytics

Hi All,

  1. After uploading customized JUnit xml reports from cli to katalon analytics. It’s showing Test suite as “cucumber.runtime.formatter.JUnitFormatter”. Can we rename the test suite name to any other name?

                                        [OR]
  1. Generating customized reports after running the test suite, I want to change the auto-generated name in JUnit XML file, From name=“cucumber.runtime.formatter.JUnitFormatter” to some other name

Could you please tell me how these JUnit files were generated?

Hi @devalex88,

I’m using runner class to generate Junit reports. Please check Example 4 in link: https://docs.katalon.com/katalon-studio/docs/running-cucumber-features-file.html#in-test-cases.

Code:
import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
@RunWith(Cucumber.class)
@CucumberOptions(features=“Your_Folder_Path”, glue="", plugin = [“pretty”,
“junit:Folder_Name/cucumber.xml”,
“html:Folder_Name”,
“json:Folder_Name/cucumber.json”])
public class MyCucumberRunner {
}

Hi, I have found a workaround for this.

We can replace the name attribute “cucumber.runtime.formatter.JUnitFormattter” in the xml file with the name you want as the report name.

I have tried with a custom keyword to replace the name in the xml and calling that in the test listener with @AfterTestcase. It worked fine for me.

Here is the Keyword to replace the name attribute in xml:

@Keyword
	def getXmlFiles(){

		String pathToFolder = RunConfiguration.getProjectDir() + '<Path to your custom report folder>'
		List<File> aList = new ArrayList<File>();

		File dir = new File(pathToFolder);

		File[] dirContents = dir.listFiles();

		for (File xmlfname : dirContents) {

			if (xmlfname.isFile() && getFileExtensionName(xmlfname).indexOf("xml") != -1) {
				aList.add(xmlfname);
			}
		}


		aList= aList.toArray(new File[aList.size()]);

		println aList
		for(int i=0;i<aList.size;i++){

			String fpath = aList[i]
			println fpath
			modifyFile(fpath,"cucumber.runtime.formatter.JUnitFormatter","MyCustomReport")
		}


	}

Thank you @srilakshmi it’s working fine