Is there a way to extract a profile into a csv?

I have a bevy of user profiles and each contains around 30 variables. I want to get a csv file of a profile. Can that be done through Katalon?

Katalon profiles are basically xml files.
So, if you write an xml parser to export the data you need as csv, the answer is yes.
Alternate, just iterate over the GlobalVariable instance selected by the curent profile and export the data as needed.
otherwise, the answer is not.

Thanks. I was hoping there was an on-board utility that I just wasn’t seeing.

Here is my solution to the topic

It requires seasoned programming skill.

Thanks. Is there any task that in any other COTS solution is mundane, that does NOT require “seasoned” programming skills? I think it’s time to re-evaluate our tool selection.

I don’t know what COTS is.

I don’t think so.

Which is a shame. For such a “mature” product, ancillary tools like this are woefully missing from KS. It’s high time the devs got their heads out of the “clouds” (pun intended) and added some of these ideas.

profile-to-json.cmd my-profile
profile-to-csv.cmd my-profile2
suite-to-whatever.cmd my-suite
etc...

@albert.vu @vu.tran @mike.verinder

1 Like

I have created a list of shames of KS:

I hope the devs to address these without getting lost in the chats about AI.

1 Like

Do you know what “Google” is?

We are not here to guess what is in your mind.
What if, for your topics, we will answer like ‘search the forum and good luck’?
Or ‘Google about it’?

Your list looks leggit.
There is only one problem.
It is opened on your Git account.
To make them more visible to the development team, better rise them at:

I am not willing to do so. The list is inteded just for my own use. It is an index of my outstanding posts that I made since years ago.

All the issues in my list are based on the posts in the Katalon Forum. So I expect (but not verified) that those issues are already acknowledged by the devs. I hope that they have listed those issues in their list.

Their issues list is too long for me. I’m not willing to be concerned about it.

Since you are a veteran on this comunity, I hope you realised up to now that, some devs may look sometime into the forum, but it is not a guarantee.
And they will never look at your personal list :smile:
I learned this with various issues I raised here and there, so I learned to not bother anymore.
If they consider it, fine, if not, also fine.

To my shame, I never rised a Git issue. I was tempted to do it, but looking at the pending list, aside of the fact you already observed, is way too long, I can see there are still opened issues not valid anymore.

So, yeah, I understand your position… somehow

Can we add one for “auto-formatting in Script View can be toggled OFF”

Can we add one for

who are we?

I found the below link that parses an XML file so you can make a cvs file of your profiles. There is no out of box KS method, but you can create a Keyword that allows you to extend or simplify your testing.

How to read XML file in Java - (DOM Parser) - Mkyong.com

Maybe like:

This just prints the Profile contents into the Console tab so you can copy and paste to create your csv file, but it shouldn’t be hard to Google a Java programming, save-to-file routine. I just used a static file pathway, but you can feed your routine any pathway you want.

import javax.xml.XMLConstants
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;

//	String pathway = "U:/Mike/Katalon/Profiles/uat.glbl";
	
	@Keyword
	public void createCSVFromXML(String pathway) {
	
		  // Instantiate the Factory
		  DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
		  
		  String myOutLine = ""
		  
		  try {
	
			  // optional, but recommended
			  // process XML securely, avoid attacks like XML External Entities (XXE)
			  dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
	
			  // parse XML file
			  DocumentBuilder db = dbf.newDocumentBuilder();
	
			  Document doc = db.parse(new File(pathway));
	
			  // optional, but recommended
			  // http://stackoverflow.com/questions/13786607/normalization-in-dom-parsing-with-java-how-does-it-work
			  doc.getDocumentElement().normalize();
	
//			  System.out.println("Root Element :" + doc.getDocumentElement().getNodeName());
//			  System.out.println("------");
	
			  // get <globalvariableentity>
			  NodeList list = doc.getElementsByTagName("GlobalVariableEntity");
		  
			  for (int temp = 0; temp < list.getLength(); temp++) {
	
				  Node node = list.item(temp);
	
				  if (node.getNodeType() == Node.ELEMENT_NODE) {
	
					  Element element = (Element) node;
	
					  // get the profile main attribute
					  String id = element.getAttribute("GlobalVariableEntity");
	
					  // get text				  
					  String desc = element.getElementsByTagName("description").item(0).getTextContent();
					  String initValue = element.getElementsByTagName("initValue").item(0).getTextContent();
					  String globalname = element.getElementsByTagName("name").item(0).getTextContent();

					  myOutLine = globalname;
					  myOutLine += ",";
					  if (initValue.contains(",")) {
						  myOutLine += '"' + initValue + '"';
					  } else {
						  myOutLine += initValue;
					  }
					  myOutLine += ",";
					  myOutLine += desc;
					  System.out.println(myOutLine)
				  }
			  }
	
		  } catch (ParserConfigurationException | SAXException | IOException e) {
			  e.printStackTrace();
		  }
	
	  }

Their list has the following issue since Jun 2020:

which is based on another post in the Katalon forum at Jan 2018.

Also there is another post similar to this

This is one of the issues outstanding long time. What’s the cause? I guess, Katalon Studio turns a script of Test Case in Script mode into Manual mode, then later it turns the script from the Manual mode back into the Script mode. Unfortunately the code transformation from the Manual mode to the Script mode seem to have some bugs. I guess there might be some technical issues in Groovy, Eclipse or Java which make the issue unable to fix. Especially I have a doubt that the Abstract Syntax Tree Transformation of the Groovy 2.4.x could have some bugs. As you may be aware, Katalon Studio uses very old version of Groovy, Eclipse, Java. If there is any problem in the base layer that blocks Katalon developers, they must starts with overhauling their product.

By the way, just recently @duyluong made a comment in another post in the Katalon forum:

He suggested that Katalon developers are trying to overhaul Katalon Studio at the moment. This must be a big news to us, Katalon users. But we all know, any changes at the base layer may cause new problems. Users should wait and see if the Katalon team could manage it.

Their issue list on GitHub has so many open issues. But why?

The GitHub repository GitHub - katalon-studio/katalon-studio is NOT the one on which Katalon developers work together to develop their product. It is just a download site. I guess, they have their own central repository, which is internal and closed, somewhere else. It’s OK, Katalon is a privately owned enterprise; they are not an open-source project.

So, possibly they are not interested in the issue list on GitHub very much.