[jbossseam-issues] [JBoss JIRA] Commented: (JBSEAM-2138) SeamTest has changed it's exception handling behavior

Norman Richards (JIRA) jira-events at lists.jboss.org
Mon Oct 22 12:46:22 EDT 2007


    [ http://jira.jboss.com/jira/browse/JBSEAM-2138?page=comments#action_12383744 ] 
            
Norman Richards commented on JBSEAM-2138:
-----------------------------------------

I'm don't think the current behavior is wrong.  An exception thrown from an action method does not necessarily indicate a failed test.  Some integration tests expect an exception to be thrown and the correct error handler to be run.  I believe it would be more correct to test that the state change or navigation outcome made by the action is correct. 

However, most tests aren't testing exceptional conditions, and we don't want to force every test to add "make sure we aren't on the error page" code.  Perhaps we should install a special error handler during tests that will be checked by default and fail the request.  That code can be overriden for the rarer tests that are testing exception conditions.

> SeamTest has changed it's exception handling behavior
> -----------------------------------------------------
>
>                 Key: JBSEAM-2138
>                 URL: http://jira.jboss.com/jira/browse/JBSEAM-2138
>             Project: JBoss Seam
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.0.CR2
>            Reporter: Max Andersen
>         Assigned To: Norman Richards
>            Priority: Critical
>             Fix For: 2.0.0.GA
>
>
> This passes with no errors in Seam 2:
> public class PingTest extends SeamTest {
> 	@Test
> 	public void test() throws Exception {
> 		new FacesRequest() {
> 			@Override
> 			protected void invokeApplication() {
> 				//call action methods here
> 				Object o = invokeMethod("#{ping.thisShouldDefinitlyNotPass}");
> 				assertNotNull(o);
> 			}
> 		}.run();
>                          System.out.println("We passed all tests!");
> 	}	
> }
> Seam 1 gives me:
> javax.el.MethodNotFoundException: Method not found: org.domain.s1.session.Plong at 392814.plongsdff()
> 	at com.sun.el.util.ReflectionUtil.getMethod(ReflectionUtil.java:143)
> 	at com.sun.el.parser.AstValue.invoke(AstValue.java:171)
> 	at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:286)
> 	at org.jboss.seam.util.UnifiedELMethodBinding.invoke(UnifiedELMethodBinding.java:36)
> 	at org.jboss.seam.actionparam.ActionParamBindingHelper.invokeTheExpression(ActionParamBindingHelper.java:58)
> 	at org.jboss.seam.actionparam.ActionParamMethodBinding.invoke(ActionParamMethodBinding.java:75)
> 	at org.jboss.seam.actionparam.ActionParamBindingHelper.invokeTheExpression(ActionParamBindingHelper.java:58)
> 	at org.jboss.seam.actionparam.ActionParamMethodBinding.invoke(ActionParamMethodBinding.java:75)
> 	at org.jboss.seam.mock.SeamTest$Request.invokeMethod(SeamTest.java:401)
> 	at org.domain.s1.test.PlongTest$1.invokeApplication(PlongTest.java:18)
> 	at org.jboss.seam.mock.SeamTest$Request.run(SeamTest.java:489)
> 	at org.domain.s1.test.PlongTest.test(PlongTest.java:24)
> 	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:585)
> 	at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:604)
> 	at org.testng.internal.Invoker.invokeMethod(Invoker.java:470)
> 	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:564)
> 	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:830)
> 	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
> 	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
> 	at org.testng.TestRunner.runWorkers(TestRunner.java:678)
> 	at org.testng.TestRunner.privateRun(TestRunner.java:624)
> This change will make tests that has a buggy el expression light up green - that's bad.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list