Forum Discussion

chanukya1's avatar
chanukya1
New Contributor
9 years ago

Jenkins throws org.apache.xmlbeans.XmlException: error: Unexpected element: CDATA but not soapUI

Hi 

I am running automated tests using SOAPUI. My tests run safe when running in SOAPUI but one test fails when running in Jenkins as maven project.

10:54:36,633 ERROR [SoapUI] An error occurred [error: Unexpected element: CDATA], see error log for details
org.apache.xmlbeans.XmlException: error: Unexpected element: CDATA
at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3486)
at org.apache.xmlbeans.impl.store.Locale.parse(Locale.java:712)
at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:696)
at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:683)
at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:208)
at org.apache.xmlbeans.XmlObject$Factory.parse(XmlObject.java:580)
at com.eviware.soapui.support.xml.XmlUtils.createXmlObject(XmlUtils.java:263)
at com.eviware.soapui.model.propertyexpansion.resolvers.ResolverUtils.extractXPathPropertyValue(ResolverUtils.java:97)
at com.eviware.soapui.model.propertyexpansion.resolvers.ResolverUtils.parseProperty(ResolverUtils.java:67)
at com.eviware.soapui.model.propertyexpansion.resolvers.ResolverUtils.checkForExplicitReference(ResolverUtils.java:44)
at com.eviware.soapui.model.propertyexpansion.resolvers.ModelItemPropertyResolver.getScopedProperty(ModelItemPropertyResolver.java:218)
at com.eviware.soapui.model.propertyexpansion.resolvers.ModelItemPropertyResolver.resolveProperty(ModelItemPropertyResolver.java:51)
at com.eviware.soapui.model.propertyexpansion.PropertyExpander.expand(PropertyExpander.java:184)
at com.eviware.soapui.model.propertyexpansion.PropertyExpander.expandProperties(PropertyExpander.java:112)
at com.eviware.soapui.impl.wsdl.testcase.WsdlTestRunContext.expand(WsdlTestRunContext.java:157)
at com.eviware.soapui.model.testsuite.TestRunContext$expand.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at Script1.run(Script1.groovy:34)
at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:100)
at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SourceFile:89)
at com.eviware.soapui.impl.wsdl.teststeps.assertions.basic.GroovyScriptAssertion.assertScript(GroovyScriptAssertion.java:122)
at com.eviware.soapui.impl.wsdl.teststeps.assertions.basic.GroovyScriptAssertion.internalAssertResponse(GroovyScriptAssertion.java:139)
at com.eviware.soapui.impl.wsdl.teststeps.WsdlMessageAssertion.assertResponse(WsdlMessageAssertion.java:165)
at com.eviware.soapui.impl.wsdl.teststeps.RestTestRequest.assertResponse(RestTestRequest.java:156)
at com.eviware.soapui.impl.wsdl.teststeps.RestTestRequest.setResponse(RestTestRequest.java:141)
at com.eviware.soapui.impl.wsdl.teststeps.RestTestRequestStep.run(RestTestRequestStep.java:927)
at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.runTestStep(AbstractTestCaseRunner.java:239)
at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.runCurrentTestStep(WsdlTestCaseRunner.java:52)
at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:152)
at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:47)
at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.run(AbstractTestRunner.java:139)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: org.xml.sax.SAXParseException; systemId: file:; lineNumber: 1; columnNumber: 53; Unexpected element: CDATA
at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.reportFatalError(Piccolo.java:1038)
at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.parse(Piccolo.java:723)
at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3454)

I am trying to load a stored variable from project custom properties.

`context.expand( '${#TestCase#ControllerIds#$[1]}' )`

Could some one tell me a fix for this.

  • I fixed the problem . actually not fixed but handled it in a different way.

    def vUControllerIds = []
    vUControllerIds = context.expand( '${#TestCase#VUControllerIds}' )
    def vUControllerId = new GroovyShell().evaluate(vUControllerIds)

  • nmrao's avatar
    nmrao
    Champion Level 3

    Would you please add groovy script and soapui version details?

    • chanukya1's avatar
      chanukya1
      New Contributor

      <groupId>com.smartbear.soapui</groupId>
      <artifactId>soapui-pro-maven-plugin</artifactId>
      <version>5.0.0</version>

       

      // my groovy script
      import groovy.json.JsonSlurper

       

      def responseContent = messageExchange.response.responseContent
      def response = new JsonSlurper().parseText(responseContent)

      def sorted_locationId_list = response.locationId.sort()

       

      def vUControllerIds = context.expand( '${#TestCase#VUControllerIds#$[0]}' )

       

      do we need to add any dependency for groovy in the maven  pom?

      • nmrao's avatar
        nmrao
        Champion Level 3
        It is showing that 34 line of your script has caused this, would you mind showing that?
        What is it doing context.expand( '${#TestCase#VUControllerIds#$[0]}' ) -- looks new syntax?