我的任务是从soapui中的xml获取值,以便在序列中创建下一个测试.
我使用groovy脚本
我的目标是在标签内获取文字.它很容易识别,因为它是base64编码的字符串.
def project = testRunner.testCase.testSuite.project ;
def tcase = project.testSuites["ChangeRetentionByCopyDemoSuite"].testCases["Milestone2"] ;
def tstep = tcase.getTestStepByName("getDocuments - GetContentURLRequest");
def responseTestSuite1 = tstep.getPropertyValue("response");
log.info(responseTestSuite1.toString());
def gutils = new com.eviware.soapui.support.GroovyUtils( context );
def holder = gutils.getXmlHolder("$responseTestSuite1");
def byteResponse = holder.getNodeValue("/S:Envelope/S:Body/g:getDocumentsResponse/text()");
Run Code Online (Sandbox Code Playgroud)
log.info(byteResponse);
xml在getDocuments - GetContentURLRequest中进行响应
Run Code Online (Sandbox Code Playgroud)<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Header> <Security xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> <Timestamp xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> <Created>2015-09-15T13:57:50.844Z</Created> <Expires>2015-09-16T13:57:50.844Z</Expires> </Timestamp> </Security> </S:Header> <S:Body> <getDocumentsResponse xmlns="http://asg.com/2009/03/schemas/tciadapters/getdocument"> <result> <operationStatus> <severity>INFO</severity> <reasonCode>A300</reasonCode> <messageText>All requests completed without errors.</messageText> </operationStatus> <documents> <DocumentData> <docId> <NameValuePair> <keyName>cmis:objectId</keyName> <keyValue>idd_48716F01-F5F7-4702-AC80-4EC70C949121</keyValue> </NameValuePair> </docId> <status xsi:nil="true" …