Buschfunk
15 years agoFrequent Contributor
[Solved] Groovy script does not find existing file
Hello,
I've generated a mock service from a WSDL with SoapUI Pro 3.6. This mock service has a test property.
Property name: InputFile
Property value: C:\Repository\Data\TEST\file.txt
Moreover the default response contains the following script:
However, the assertion fails though this file definitely exists.
Inserting log.info(filename)[/font:2bt5mkkn] into the script outputs:
C:\Repository\Data\TEST\file.txt[/font:2bt5mkkn]
The assertion passes if I change the code as follows:
Setting the property value to C:\\Repository\\Data\\TEST\\file.txt also results in a failing assertion.
Does anybody have an idea?
Thanks,
Robert
I've generated a mock service from a WSDL with SoapUI Pro 3.6. This mock service has a test property.
Property name: InputFile
Property value: C:\Repository\Data\TEST\file.txt
Moreover the default response contains the following script:
def filename = context.expand(' ${#MockService#InputFile} ')
def f = new File(filename)
assert f.exists()
However, the assertion fails though this file definitely exists.
Inserting log.info(filename)[/font:2bt5mkkn] into the script outputs:
C:\Repository\Data\TEST\file.txt[/font:2bt5mkkn]
The assertion passes if I change the code as follows:
def filename = context.expand(' ${#MockService#InputFile} ')
def f = new File("C:\\Repository\\Data\\TEST\\file.txt")
assert f.exists()
Setting the property value to C:\\Repository\\Data\\TEST\\file.txt also results in a failing assertion.
Does anybody have an idea?
Thanks,
Robert