cancel
Showing results for 
Search instead for 
Did you mean: 

create a folder and insert xml file in the folder at runtime

New Contributor

create a folder and insert xml file in the folder at runtime

Hi,

Using a groovy script, i want to create a new folder and insert xml files in the folder at runtime.

 

Can anyone help me?

Tags (2)
2 REPLIES 2
Community Hero

Re: create a folder and insert xml file in the folder at runtime

// String contents = ...
new File("myfolder").mkdirs()
new File("myfolder/mydoc.xml").text = contents
Highlighted
New Contributor

Re: create a folder and insert xml file in the folder at runtime

My codes and it works:

 

def path = new com.eviware.soapui.support.GroovyUtils( context) // Getting relative path
def bkpath = (path.projectPath + "\\yourFolder\\")
//log.info(bkpath)
def folderName = ("XXXX" + variable)
def RMDir = new File("$bkpath/$folderName") // Path of folder to create
//log.info(RMDir)
RMDir.mkdir()

 

 

//Writing external file
def xxxx = context.expand('${Export_xxxxx#Response}')
new File("${RMDir}/" + "xxxx.xml").write( xxxx )

New Here?
Join us and watch the welcome video:
Top Kudoed Authors