Quantcast

Exception handling in WebTest plugin

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Exception handling in WebTest plugin

pompl

Hi,

the WebTest plugin (tested: 0.3 and 0.4) breaks if an exception (i.e. ConnectException) occurs in a test.
Following tests will not be executed, a HTML report is not generated.
This is very frustrating if you have embedded webtest in a continuous integration/automatic build running on a server the developer has no access to.

Example:
class ExceptionTest extends grails.util.WebTest {
   void suite() {
       testExceptionInWebtest()
       testExceptionInAntGroup()
   }


    def testExceptionInWebtest() {
       webtest('Exception In Webtest') {
         throw new Exception()
       }
   }


    def testExceptionInAntGroup() {
       webtest('Exception In Ant Group') {
         myStep();
       }
   }


    def myStep() {
     ant.group(description:'Here it fails') {
         throw new Exception()
     }
   }
}


In my opinion webtest should continue on the next test and note the exception in the report.

Should I raise an issue for the plugin? Or is it an issue in webtest?



Best regards
Marc Pompl
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

RE: Exception handling in WebTest plugin

Dierk König
you can go to the webtest.properties file and check that
both
 haltonerror
and
 haltonfailure
are both set to "false"

cheers
Dierk

| -----Original Message-----
| From: [hidden email] [mailto:[hidden email]]
| Sent: Montag, 5. Mai 2008 9:48
| To: [hidden email]
| Subject: [grails-user] Exception handling in WebTest plugin
|
|
| Hi,
|
| the WebTest plugin (tested: 0.3 and 0.4) breaks if an
| exception (i.e. ConnectException) occurs in a test.
| Following tests will not be executed, a HTML report is not generated.
| This is very frustrating if you have embedded webtest in a
| continuous integration/automatic build running on a server
| the developer has no access to.
|
| Example:
| class ExceptionTest extends grails.util.WebTest {
|    void suite() {
|        testExceptionInWebtest()
|        testExceptionInAntGroup()
|    }
|
|     def testExceptionInWebtest() {
|        webtest('Exception In Webtest') {
|          throw new Exception()
|        }
|    }
|
|     def testExceptionInAntGroup() {
|        webtest('Exception In Ant Group') {
|          myStep();
|        }
|    }
|
|     def myStep() {
|      ant.group(description:'Here it fails') {
|          throw new Exception()
|      }
|    }
| }
|
| In my opinion webtest should continue on the next test and
| note the exception in the report.
|
| Should I raise an issue for the plugin? Or is it an issue in webtest?
|
|
|
| Best regards
| Marc Pompl
|
|

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Antwort: [grails-user] Exception handling in WebTest plugin

pompl

Hi, Dierk,
I would say, they are already at the mentioned values, as you can see. :(



webtest_summary             = true
webtest_saveresponse        = true
webtest_resultpath          = webtest/reports
webtest_resultfile          = WebTestResults.xml
webtest_haltonerror         = false
webtest_errorproperty       = webTestError
webtest_haltonfailure       = false
webtest_failureproperty     = webTestFailure
webtest_showhtmlparseroutput= true


Best regards
Marc Pompl
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

RE: Antwort: [grails-user] Exception handling in WebTest plugin

Dierk König
hm, ok...

thinking
Dierk

| -----Original Message-----
| From: [hidden email] [mailto:[hidden email]]
| Sent: Montag, 5. Mai 2008 16:28
| To: [hidden email]
| Subject: [grails-user] Antwort: [grails-user] Exception
| handling in WebTest plugin
|
|
| Hi, Dierk,
| I would say, they are already at the mentioned values, as you
| can see. :(
|
|
|
| webtest_summary             = true
| webtest_saveresponse        = true
| webtest_resultpath          = webtest/reports
| webtest_resultfile          = WebTestResults.xml
| webtest_haltonerror         = false
| webtest_errorproperty       = webTestError
| webtest_haltonfailure       = false
| webtest_failureproperty     = webTestFailure
| webtest_showhtmlparseroutput= true
|
|
|
| Best regards
| Marc Pompl
|

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

RE: Exception handling in WebTest plugin ---- another funny case

pompl

Hi, Dierk,

here is another one for making you thinking. ;) Except: webtest continues and prints out the exception in the desired manner.

Not the same error case as before, but it also hides the original exception. :((


This one only appears from time to time. But after it happens, I have to restart the grails server.
I will continue to investigate. In meantime, it would be nice to see the REAL stacktrace. :)



Best regards
Marc Pompl

java.lang.ClassCastException: org.apache.commons.httpclient.NoHttpResponseException cannot be cast to java.lang.RuntimeException
                at com.canoo.webtest.steps.AbstractStepContainer.executeContainedStep(AbstractStepContainer.java:79)
                at com.canoo.webtest.steps.AbstractStepContainer.executeContainedSteps(AbstractStepContainer.java:91)
                at com.canoo.webtest.steps.control.GroupStep.doExecute(GroupStep.java:14)
                at com.canoo.webtest.steps.Step.execute(Step.java:104)
                at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
                at org.apache.tools.ant.Task.perform(Task.java:364)
                at com.canoo.webtest.ant.TestStepSequence.executeSteps(TestStepSequence.java:43)
                at com.canoo.webtest.ant.TestStepSequence.doExecute(TestStepSequence.java:31)
                at com.canoo.webtest.steps.Step.execute(Step.java:104)
                at org.apache.tools.ant.Task.perform(Task.java:364)
                at com.canoo.webtest.ant.WebtestTask.execute(WebtestTask.java:164)
                at org.apache.tools.ant.Task.perform(Task.java:364)
                at groovy.util.AntBuilder.nodeCompleted(AntBuilder.java:178)
                at groovy.util.BuilderSupport.doInvokeMethod(BuilderSupport.java:153)
                at groovy.util.AntBuilder.doInvokeMethod(AntBuilder.java:132)
                at groovy.util.BuilderSupport.invokeMethod(BuilderSupport.java:64)
                at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:781)
                at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:757)
                at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:167)
                at grails.util.WebTest.webtest(WebTest.groovy:19)
                at sun.reflect.GeneratedMethodAccessor26.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:597)
                at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
                at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:226)
                at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:899)
                at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrentN(ScriptBytecodeAdapter.java:77)
                at SucheTest.testSucheUnerlaubteZeichen(SucheTest.groovy:163)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:597)
                at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
                at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:226)
                at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:899)
                at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrentN(ScriptBytecodeAdapter.java:77)
                at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrent0(ScriptBytecodeAdapter.java:109)
                at SucheTest.suite(SucheTest.groovy:16)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:597)
                at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
                at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:226)
                at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:899)
                at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:740)
                at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:777)
                at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:757)
                at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:167)
                at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethod0(ScriptBytecodeAdapter.java:195)
                at TestSuite.suite(TestSuite.groovy:22)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:597)
                at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
                at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:226)
                at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:899)
                at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrentN(ScriptBytecodeAdapter.java:77)
                at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrent0(ScriptBytecodeAdapter.java:109)
                at grails.util.WebTest.runTests(WebTest.groovy:38)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:597)
                at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
                at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:226)
                at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:899)
                at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:740)
                at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:777)
                at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:757)
                at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:167)
                at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethod0(ScriptBytecodeAdapter.java:195)
                at TestSuite.main(TestSuite.groovy:8)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:597)
                at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
                at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:226)
                at groovy.lang.MetaClassImpl.invokeStaticMethod(MetaClassImpl.java:1094)
                at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:748)
                at groovy.lang.GroovyShell.runMainOrTestOrRunnable(GroovyShell.java:244)
                at groovy.lang.GroovyShell.run(GroovyShell.java:218)
                at groovy.lang.GroovyShell.run(GroovyShell.java:147)
                at groovy.ui.GroovyMain.processOnce(GroovyMain.java:493)
                at groovy.ui.GroovyMain.run(GroovyMain.java:308)
                at groovy.ui.GroovyMain.process(GroovyMain.java:294)
                at groovy.ui.GroovyMain.processArgs(GroovyMain.java:111)
                at groovy.ui.GroovyMain.main(GroovyMain.java:92)
Loading...