I have made a demo project on GitHub:
--------------------
This demo project was developed in the hope to help solving problems raised by a post in the Katalon Forum: “Is there a way to Mass-Edit many objects in the Object Repository”
The problem was:
- The questioner has created a mass of Test Objects (>2000) in the ‘Object Repository’ in a Katalon Studio project.
- Test Objects can be configured to use various selectors:
id
,name
,text
,xpath
,class
,tag
. - One day he has made up his mind to standardize the way of selector assignment: use
tag
andclass
only. No longer to useid
selector. - Now he has to reconfigure >2000 Test Objects in the ‘Object Repository’ manually. It is hard obviously.
Solution proposed
Manually verifying and reconfiguring massive Test Objects is tiring. Failure tends to occur. Support by software tool is desired.
This project includes 2 test cases.
Test Cases/ObjectRepositoryVerifier
This Groovy script is designed to meet the following need:
I want all of my Test Objects to have
tag
selector andclass
selector defined, and these 2 selectorsselected
. How can I check this? I have too many. I want a tool which tells me which Test Objects are missingtag
andclass
selectors.
This Groovy script employs the XPath technology bundled in the JDK as javax.xml.xpath.XPath
and other classes.
The verification criteria is implemented as a set of Strings as XPath expression in the Groovy script. You can customize the verification criteria by modifying the expressions.
Test Cases/ObjectRepositoryTransformer
This Groovy script is designed to meet the following need:
I want to rewrite the *rs files in the
Object Repository
directory. The *rs files are in XML format, these are the definition of my Test Objects. I want a tool which transforms mass of *.rs files for me. The resulting Test Objects should havetag
selector andclass
selector retained, and other types of selectors erased. I want to create a temporary directory in the Katalon project, so that I find all resulting Test Objects are saved there. I do not want the tool change the original ‘Object Repository’.
This Groovy script employs the XSLT technology bundled in the JDK as javax.xml.transform.Trasformer
and other classes.
The transformation is implemented as a XSLT stylesheet. By modifying the stylesheet, you can customize the way how the *.rs files are transformed.