Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/347.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java “如何解决错误”;意外元素:CDATA";在通过groovy脚本运行测试步骤时?_Java_Testing_Soap_Groovy_Soapui - Fatal编程技术网

Java “如何解决错误”;意外元素:CDATA";在通过groovy脚本运行测试步骤时?

Java “如何解决错误”;意外元素:CDATA";在通过groovy脚本运行测试步骤时?,java,testing,soap,groovy,soapui,Java,Testing,Soap,Groovy,Soapui,我运行的测试套件包含15个测试步骤,其中混合了groovy脚本和soap请求步骤 当我手动运行时,它运行得非常完美,因为它在通过groovy脚本执行时会发出错误消息,如“Unexpected Element:CDATA” Groovy脚本: for(tc in testsuite.testCaseList) { for(stp in tc.testStepList) { if (!stp.isDisabled()) { testRunner.

我运行的测试套件包含15个测试步骤,其中混合了groovy脚本和soap请求步骤

当我手动运行时,它运行得非常完美,因为它在通过groovy脚本执行时会发出错误消息,如“Unexpected Element:CDATA”

Groovy脚本:

for(tc in testsuite.testCaseList)
{
   for(stp in tc.testStepList)
   {
      if (!stp.isDisabled())
      {
         testRunner.runTestStep(stp)

         def assertionList = stp.getAssertionList()
         ..........
      }
   }
}
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
def responseHolder = groovyUtils.getXmlHolder("requestName#Response")
def appId = responseHolder.getNodeValue("//*:application/*:applicationId")

testRunner.testCase.testSuite.setPropertyValue("AppId",appId)
通过另一个groovy脚本步骤获取响应数据:

for(tc in testsuite.testCaseList)
{
   for(stp in tc.testStepList)
   {
      if (!stp.isDisabled())
      {
         testRunner.runTestStep(stp)

         def assertionList = stp.getAssertionList()
         ..........
      }
   }
}
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
def responseHolder = groovyUtils.getXmlHolder("requestName#Response")
def appId = responseHolder.getNodeValue("//*:application/*:applicationId")

testRunner.testCase.testSuite.setPropertyValue("AppId",appId)
有谁能给我你解决这个问题的建议吗

谢谢

Karunagara Pandi G

请编辑您的问题,并提供
requestName#Response
的值和完整错误。您好,我正在尝试从响应中获取应用程序Id的值。这是响应中的一个标记。Ok。我相信问题在于回应。如果问题属于回应,我该怎么办。我可以在手动运行测试步骤时获取“appid”。但唯一的问题是我在运行“groovy脚本”时遇到了这个问题,正如我在文章中提到的。如果响应中存在问题,请询问以修复响应。