Forum Discussion

shiva_kakarla's avatar
shiva_kakarla
Contributor
17 years ago

log.info() and println statements logging

Hi,

I want to capture the output from groovy context and use it in my test case


Below script writes onto dos console and I cant copy everything due to buffer limitation.

for(i in 0.. 10000)
{
println ''
println i*330
println '
'
}

Could you let me know if there is a way in SOAPUI groovy to capture the output.

Also log.info('') appends time stamp on every line. Is there a way to not to print timestamp.

Thanks
Shiva

8 Replies

  • omatzura's avatar
    omatzura
    Super Contributor
    Hi,

    sorry, the groovy log is pretty fixed currently. Exactly what do you want to do?

    regards,

    /Ole
    eviware.com
  • Hi Ole

    Wanted to get output as in below format controlling in a loop. I can generate this in other IDE's but was trying in SOAPUI groovy.


      1


      2


      3

    .....


    Different question:

    What is the context variable in this line
    def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )

    I have a requirement to write a groovy script outside of SOAPUI tool which loads SOAPUI projects from a specific directory and executes tests in each of those projects. Is there a sample that I can refer to?

    Thanks
    Shiva
  • Hi Ole

    I am trying to create wsdl project in groovy. I am using eclipse ide and I get out of memory: java heap space. I changed my VM args in eclispe.ini file to 512MB. Is there a way to set heap size for loading wsdl project?


    Here is th code snippet that I have in my groovy.


    import com.eviware.soapui.*;
    import com.eviware.soapui.support.*;
    import com.eviware.soapui.model.propertyexpansion.*;
    import com.eviware.soapui.impl.wsdl.WsdlProject;
    import com.eviware.soapui.impl.wsdl.*;
    import com.eviware.soapui.model.iface.*;


    WsdlProject project = new WsdlProject("C:/End2End-soapui-project.xml");


    Exception is


    Configuring log4j from [jar:file:/C:/P4_WS/mft/dev/3.6L2/java-common/tools/soapuipro/lib/soapui-2.0.2.jar!/soapui-log4j.xml]
    17:06:34,976 WARN  [DefaultSoapUICore] Missing folder [C:\P4_WS\GroovyJava\ext] for external libraries
    17:06:34,976 INFO  [DefaultSoapUICore] Creating new settings at [C:\P4_WS\GroovyJava\soapui-settings.xml]
    Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
    at org.apache.xmlbeans.impl.store.CharUtil.allocate(CharUtil.java:397)
    at org.apache.xmlbeans.impl.store.CharUtil.saveChars(CharUtil.java:506)
    at org.apache.xmlbeans.impl.store.Cur$CurLoadContext.text(Cur.java:2911)
    at org.apache.xmlbeans.impl.store.Cur$CurLoadContext.stripText(Cur.java:3125)
    at org.apache.xmlbeans.impl.store.Cur$CurLoadContext.text(Cur.java:3138)
    at org.apache.xmlbeans.impl.store.Locale$SaxHandler.characters(Locale.java:3283)
    at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.reportCdata(Piccolo.java:992)
    at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.parseXMLNS(PiccoloLexer.java:1290)
    at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.parseXML(PiccoloLexer.java:1261)
    at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.yylex(PiccoloLexer.java:4808)
    at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.yylex(Piccolo.java:1290)
    at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.yyparse(Piccolo.java:1400)
    at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.parse(Piccolo.java:714)
    at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3444)
    at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1275)
    at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1262)
    at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:345)
    at com.eviware.soapui.config.SoapuiProjectDocumentConfig$Factory.parse(Unknown Source)
    at com.eviware.soapui.impl.wsdl.WsdlProject.loadProject(WsdlProject.java:221)
    at com.eviware.soapui.impl.wsdl.WsdlProject.(WsdlProject.java:159)
    at com.eviware.soapui.impl.wsdl.WsdlProject.(WsdlProject.java:126)
    at com.eviware.soapui.impl.wsdl.WsdlProject.(WsdlProject.java:121)
    at com.eviware.soapui.impl.wsdl.WsdlProject.(WsdlProject.java:111)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.codehaus.groovy.runtime.MetaClassHelper.doConstructorInvoke(MetaClassHelper.java:526)
    at groovy.lang.MetaClassImpl.doConstructorInvoke(MetaClassImpl.java:2331)
    at groovy.lang.MetaClassImpl.invokeConstructor(MetaClassImpl.java:1227)
    at groovy.lang.MetaClassImpl.invokeConstructor(MetaClassImpl.java:1157)
    at org.codehaus.groovy.runtime.InvokerHelper.invokeConstructorOf(InvokerHelper.java:801)
  • omatzura's avatar
    omatzura
    Super Contributor
    Hi,

    hmm.. you'll probably just have to increase the eclipse HeapSize even more.. what is the memory-setting for soapUI with this project?

    regards,

    /Ole
    eviware.com
  • Hi Ole
    For SOAPUI I set Xms1536m -Xmx1536m.  Guess this size is huge. Eclipse support max 1024. If I give more than that eclipse does not start.

    Thanks
    Shiva
  • omatzura's avatar
    omatzura
    Super Contributor
    Hi,

    well, it seems your project File is very large.. is that correct? Is there any way for you to split it into several projects?

    regards,

    /Ole
    eviware.com
  • Hi Ole,

    Yep the project file is very large around 80 test cases and the size of file is 30 MB. Well its end to end integration test project to verify the system. I can split it into multiple projects and consolidate the output reports but its pain and needs more effort.

    I will check if Eclipse has any fix to take more than 1024M else I will split the project.

    Thanks
    Shiva