I am wanting to create an automated test case within Ready API that creates 2D data matrices from input strings that come back in the response to a REST web service request. I would like for the script to save these 2D data matrices as GIF or JPEG images to a folder on my machine.
I have a script (below) that extracts the indiciaStream from the response and decodes it to create a string. The last step in this step just assigns the decoded string to a testCase property which I then write to a data source. But I'd like to be able to create the 2D data matrices from the script and store on my machine.
Any help would be much appreciated.
def response = context.expand( '${createRequest#Response}' );
def slurper = new XmlSlurper().parseText(response)
String indiciaStream = slurper.Body.createResponse.CreateResponse.IndiciaStream
byte[] decodedIS = indiciaStream.decodeBase64();
String decodedIndiciaStream = new String(decodedIS);
testRunner.getTestCase().setPropertyValue('decodedIndiciaStream',decodedIndiciaStream)
The inidicia stream looks like ...
SkdCIDgyMTUxQTA2MDAwMDAwNTZGMDAwMDIwMDEwMDQ0MDI1MDkxNTAwNyAgS0IwNjAwMDAyODVHQjIxICBNMTU0UFMgICBHQiBDTTE2NkxMUyAg
And decoded it looks like ...
JGB 82151A0600000056F0000200100440250915007 KB060000285GB21 M154PS GB CM166LLS