Forum Discussion

jradom's avatar
jradom
New Contributor
7 years ago

problem finding file path when running SOAPUI from Java roject

I'm using SOAPUI open source and have a Groovy step which reads a file and write data into a file.  I can successfully locate the files when run test step using SOAPUI own UI.  When I run the same step from Java and use relative path using 

def projectPath = new com.eviware.soapui.support.GroovyUtils(context).projectPath

i see an error that path for my file is not found.  But if i use hard coded path it works but I can't do it because need to run it on Jenkins.  Below is sample code

def projectPath = new com.eviware.soapui.support.GroovyUtils(context).projectPath
def now = new Date()

timeStr1 =System.currentTimeMillis().toString()
suffix ='10000000000000'

projectPath = "C://Users//jradom.ORADEV//Workarea//ai-candidate-matching-qa-new//ai-candidate-matching-qa//QACMCloudWatchdogTest//src//main//resources"

If I comment above line and run my project from Java i see Path related error

ApplicantOriginalFileName = 'applicantOriginal1'
ApplicantEntityStatusValue = 'ACTIVE'
ApplicantRecommendationFlagValue = 'true'

for (i = 0; i <projectPath.length(); i++) {
projectPath = projectPath.replace("\\", "//")
}

dir = projectPath + "//applicants//"

// preparing Applicant data
filenameOriginal2 = projectPath + "//applicantOriginal1.json"

 

Please help

 

Jeff