Forum Discussion
Finan
14 years agoFrequent Contributor
I do not know how to switch the output thats base64 encode to a img, but I assume its an encoded bytestream, so I've written the following script that should do the trick.
The script is added to a new testCase that has the encoded String as testCase property. (So it can be run as runTestCase testStep).
The filename contains the path you want to write to relative to the projectpath. (Path should also include the extension)
The script is added to a new testCase that has the encoded String as testCase property. (So it can be run as runTestCase testStep).
The filename contains the path you want to write to relative to the projectpath. (Path should also include the extension)
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context );
import org.apache.commons.codec.binary.Base64;
Base64 coder = new Base64();
def filename = context.expand( '${#TestCase#filename}' )
def encodedString = context.expand( '${#TestCase#encodedString}' );
def decoded = encodedString.decodeBase64();
def f = new File(groovyUtils.projectPath + filename);
f.delete();
f << decoded
log.info(groovyUtils.projectPath + filename);
Related Content
- 5 years ago
- 7 years ago
- 3 years ago
- 11 years ago