We are building a new experience for our SmartBear Community.
This site is now read-only. You can still browse and search as usual. Learn More
This site is now read-only. You can still browse and search as usual. Learn More
I have a data load that uses XLS as a source and SOAP as a destination.
The test steps are:
The above works fine and the records are created and attachment added where the attachment is a property (column) in the XLS file and contains base64 data.
What I would like to be able to do instead is load a file at run time by using a column in the xls file to specify the file name to load and convert.
for example the source column would contain the value C:\Temp\MyPic.jpg and when posting the soap request SoapUI would load the file C:\Temp\MyPic.jpg, convert it, and pass it as Base64 data in the Soap Properties.
You should be able to do this with a Groovy Script Test Step, using code something like:
// You may have to escape backslashes, or store the file path and name as a URI
def yourFilename = 'Obtain filename from data source'
def file = new File(yourFilename)
def base64encodedData = file.getBytes().encodeBase64().toString()
log.info('Base64 data = ' + base64encodedData)
def soapRequestData = 'Build your SOAP request with Base64 data here'
testRunner.getTestCase().getTestStepByName('SOAP Request').setPropertyValue('Request', soapRequestData)
If you are unsure how to get the filename from the data source via Groovy, you can use the point and click https://support.smartbear.com/readyapi/docs/testing/properties/get-data.html GUI method.