我想在Ready API中创建一个自动化测试用例,它从输入字符串创建2D数据矩阵,这些字符串在REST Web服务请求的响应中返回。我希望脚本将这些2D数据矩阵保存为GIF或JPEG图像到我机器上的文件夹中。
我有一个脚本(下面)从响应中提取indiciaStream并对其进行解码以创建一个字符串。此步骤的最后一步只是将解码后的字符串分配给testCase属性,然后将其写入数据源。但是我希望能够从脚本创建2D数据矩阵并存储在我的机器上。
非常感谢任何帮助。
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)
inidicia流看起来像......
SkdCIDgyMTUxQTA2MDAwMDAwNTZGMDAwMDIwMDEwMDQ0MDI1MDkxNTAwNyAgS0IwNjAwMDAyODVHQjIxICBNMTU0UFMgICBHQiBDTTE2NkxMUyAg
并解码它看起来像......
JGB 82151A0600000056F0000200100440250915007 KB060000285GB21 M154PS GB CM166LLS