cancel
Showing results for 
Search instead for 
Did you mean: 

count nodes in http test step

Highlighted
Super Contributor

count nodes in http test step

Hello,
I have a http test request (look at response below). I am trying to count certain nodes in it using this code

def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def holder = groovyUtils.getXmlHolder( "HTTP Test Request#Response" )
def cnt = holder["count(//html/body/pre/a)"]

but I get this error
Tue Feb 03 09:27:54 PST 2009:ERROR:An error occured [error: does not close tag <meta />.], see error log for details

If I create a count assertion using soapui (using same xpath) count assertion, I get no error.

HTTP Response:

 
      <meta content="HTML Tidy, see <!-- w --><a class=" postlink="" />www.w3.org" name="generator"/>
      <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
      cswebdev.tvguide.com - /epgrepository/01272009/3/6/4/7/9/7/1/
 
 
     

cswebdev.tvguide.com - /epgrepository/01272009/3/6/4/7/9/7/1/


     

     

        [To Parent Directory]
       

       

        Tuesday, January 27, 2009  2:51 PM      3915190
        01272009.xml
       

        Tuesday, January 27, 2009  2:51 PM      3930203
        01282009.xml
       

        Tuesday, January 27, 2009  2:51 PM      3854195
        01292009.xml
       

        Tuesday, January 27, 2009  2:51 PM      3711219
        01302009.xml
       

        Tuesday, January 27, 2009  2:51 PM      3552237
        01312009.xml
       

        Tuesday, January 27, 2009  2:51 PM      3666199
        02012009.xml
       

        Tuesday, January 27, 2009  2:50 PM      3837871
        02022009.xml
       

        Tuesday, January 27, 2009  2:50 PM      3753802
        02032009.xml
       

        Tuesday, January 27, 2009  2:50 PM      3718255
        02042009.xml
       

        Tuesday, January 27, 2009  2:50 PM      3659345
        02052009.xml
       

        Tuesday, January 27, 2009  2:50 PM      3430281
        02062009.xml
       

        Tuesday, January 27, 2009  2:50 PM      3208006
        02072009.xml
       

        Tuesday, January 27, 2009  2:50 PM      3246209
        02082009.xml
       

        Tuesday, January 27, 2009  2:51 PM      3311282
        02092009.xml
       

     

     

 
4 REPLIES 4
Highlighted
Super Contributor

Re: count nodes in http test step

Hi Ali,

strange! Can you show the contents of the error log?

regards!

/Ole
eviware.com
Highlighted
Super Contributor

Re: count nodes in http test step

Tue Feb 03 12:15:07 PST 2009:ERROR:org.apache.xmlbeans.XmlException: error: does not close tag <meta />.
  org.apache.xmlbeans.XmlException: error: does not close tag <meta />.
  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.XmlHolder.(XmlHolder.java:36)
  at com.eviware.soapui.support.XmlHolder.(XmlHolder.java:51)
  at com.eviware.soapui.support.GroovyUtils.getXmlHolder(GroovyUtils.java:54)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  at java.lang.reflect.Method.invoke(Unknown Source)
  at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
  at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:230)
  at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:912)
  at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:756)
  at org.codehaus.groovy.runtime.InvokerHelper.invokePojoMethod(InvokerHelper.java:766)
  at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:754)
  at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:170)
  at Script2.run(Script2.groovy:12)
  at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:59)
  at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SourceFile:52)
  at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:148)
  at com.eviware.soapui.impl.wsdl.panels.teststeps.GroovyScriptStepDesktopPanel$RunAction.actionPerformed(GroovyScriptStepDesktopPanel.java:235)
  at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
  at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
  at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
  at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
  at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
  at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
  at java.awt.Component.processMouseEvent(Unknown Source)
  at javax.swing.JComponent.processMouseEvent(Unknown Source)
  at java.awt.Component.processEvent(Unknown Source)
  at java.awt.Container.processEvent(Unknown Source)
  at java.awt.Component.dispatchEventImpl(Unknown Source)
  at java.awt.Container.dispatchEventImpl(Unknown Source)
  at java.awt.Component.dispatchEvent(Unknown Source)
  at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
  at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
  at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
  at java.awt.Container.dispatchEventImpl(Unknown Source)
  at java.awt.Window.dispatchEventImpl(Unknown Source)
  at java.awt.Component.dispatchEvent(Unknown Source)
  at java.awt.EventQueue.dispatchEvent(Unknown Source)
  at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
  at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
  at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
  at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
  at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
  at java.awt.EventDispatchThread.run(Unknown Source)
  Caused by: org.xml.sax.SAXParseException: does not close tag <meta />.
  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)
  ... 50 more
Highlighted
Super Contributor

Re: count nodes in http test step

Hi!

ok.. you need to refer to the "ResponseAsXml" property instead;

...
def holder = groovyUtils.getXmlHolder( "HTTP Test Request#ResponseAsXml" )
...

Does that help?

regards!

/Ole
eviware.com
Highlighted
Super Contributor

Re: count nodes in http test step

that works.

thanks

Ali
New Here?
Join us and watch the welcome video:
Announcements
TechCorner Leaderboard
Compete with community members in the TechCorner Challenge and get into the Leaderboard!

Rank Participant Points Earned
1 msiadak 12
2 nmrao 8
3 HimanshuTayal 3
Top Kudoed Authors