Ask a Question

Relative Path in SoapUI and Groovy Scripts

tmssz
New Contributor

Relative Path in SoapUI and Groovy Scripts

Hello Programmers,

 

I have one problem with using relative path in SoapUI and Groovy.

It really plays on my nerves!

This is because of different systems (Mac/Windows/RedHat) and different working style of people (Java programmers and these based on other languages).

 

So what is the problem: access to files

One college defines the file in properties for Test case (specific) like this: /Projekte/GTC/SOAPUI/6408.jks

Other guys are defining the same but on the Project level direct: 6408.jks

 

Other make this in groovy scipt:

 

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

def keystoreFile = projectPath + "/6408.jks";

 

Other are defining the work and project dir:

 

workspaceDir="C:\\TEST2\\"
projectDir="C:\\TEST2\\"
log.info(workspaceDir)
log.info(projectDir)

def keystoreFile = projectPath + "\\6408.jks";

 

It always ends is sth like:

 

Step 3 [] OK: took 127 ms
TestCase [] failed [Cancelling due to failed test step:java.io.FileNotFoundException: 6408.jks (Das System kann die angegebene Datei nicht finden)], time taken = 130
TestSuite [useToken] failed [null], time taken = 257
Step 4 [generate-issue-request-response] FAILED: took 3 ms
-> java.io.FileNotFoundException: 6408.jks (Das System kann die angegebene Datei nicht finden)
-> error at line: 38

 

And my question is:

 

1) How should I define on the SOAPUI - WORKING katalog but I would like to have relative path where SOAP-Projekt is? So to be able to copy the structure and run this on any computer even from network drive.

I.e something like below

Local catalog:        TestFolder\soapui-project.xml

Local subcatalogs: TestFolder\secrets\6408.jks

Local subcatalogs: TestFolder\templates\soapui-project.xsd

Local subcatalogs: TestFolder\users\6408.txt

 

2) How to write the code to have the same setting for all environments? Linux, Windows and Mac.

Should I use special test function for using specific groovy code for OS (Operating System)?

My colleges need working SoapUI Suite - just click and run ... on any OS. No chance to give any tips what to change and how.

 

3) Where is the default path that groovy/soap searches for the file? Is it where the binaries were run ... so somewhere in ... Soap UI installation BIN?

 

Thanks for tips.

Tomasz

P.s.

I am not programmer. I can change code, write some modifications etc, but definetely not able (time limited) to redesign all testing cases.

Test cases are for 5 different test environment with different configurations so - I must be really flexible with this local paths.

 

 

 

 

0 REPLIES 0
cancel
Showing results for 
Search instead for 
Did you mean: