How you test is up to you Juan, but if I may be so bold as to give you a humble 
opinion: I think testing is not worthwhile if you don't isolate portions of 
code from their dependencies to validate their behavior, in other words if you 
include too much, you will just be rewriting everything and will eventually 
need tests for your tests. If you want to do integration tests then test only 
integration, and not the behavior or state of units as such, keep those as 
separate unit tests.

Sorry, but I don't think I can provide you the solution you want... but I don't 
know what will.

Kind regards,
Peter

----- Original Message -----
From: "Juan E. Maya" <maya.j...@gmail.com>
To: "Tapestry users" <users@tapestry.apache.org>
Sent: Friday, 17 July, 2009 11:14:11 GMT +02:00 Athens, Beirut, Bucharest, 
Istanbul
Subject: Re: Tapestry-Spring Security & Page Testing

Yes i tried and although it's possible i would be removing the
security module from the tests and that's actually one of the critical
things we want to test when testing the pages.

 Fri, Jul 17, 2009 at 9:53 AM, Peter
Stavrinides<p.stavrini...@albourne.com> wrote:
> Have you tried to use a Mock object for this?
>
> Peter
> ----- Original Message -----
> From: "Juan E. Maya" <maya.j...@gmail.com>
> To: "Tapestry users" <users@tapestry.apache.org>
> Sent: Friday, 17 July, 2009 10:25:15 GMT +02:00 Athens, Beirut, Bucharest, 
> Istanbul
> Subject: Re: Tapestry-Spring Security & Page Testing
>
> Oh sorry for that. I thought it was the page for tapestry-test. I am
> actually already using testify.
>
> The problem i was referring occurs because Spring-Security detects
> that the render of a page doesn't come from an HttpServletRequest
> (Correct me if i am wrong). I could just not use the security module
> at all in my tests but then security will not take part on the testing
> and i am not so eager to this.
>
>
> On Fri, Jul 17, 2009 at 7:39 AM, Peter
> Stavrinides<p.stavrini...@albourne.com> wrote:
>> Testify is not selenium, its basic unit and integration testing, built on 
>> top of Tapestry and page tester you do you need a browser.
>>
>> ----- Original Message -----
>> From: "Juan E. Maya" <maya.j...@gmail.com>
>> To: "Tapestry users" <users@tapestry.apache.org>
>> Sent: Thursday, 16 July, 2009 17:54:23 GMT +02:00 Athens, Beirut, Bucharest, 
>> Istanbul
>> Subject: Re: Tapestry-Spring Security & Page Testing
>>
>> I had already look at it, but due to restrictions in the test server
>> we can't launch an instance of a browser to execute the test.
>>
>> Thanks anyway Peter
>>
>> On Thu, Jul 16, 2009 at 4:26 PM, <p.stavrini...@albourne.com> wrote:
>>> Look at the project Tapestry testify:
>>> https://tapestry.formos.com/nightly/tapestry-testify/
>>>
>>> This should give you the tools you need to test your pages precisely, you 
>>> also will need to include a mocking framework (EasyMock or Mockito) with 
>>> testify.
>>>
>>> good luck,
>>> Peter
>>>
>>> ----- Original Message -----
>>> From: "Juan E. Maya" <maya.j...@gmail.com>
>>> To: "Tapestry users" <users@tapestry.apache.org>
>>> Sent: Thursday, 16 July, 2009 17:09:23 GMT +02:00 Athens, Beirut, 
>>> Bucharest, Istanbul
>>> Subject: Re: Tapestry-Spring Security & Page Testing
>>>
>>> I came to the conclusion (maybe i am wrong) that this is not possible
>>> (at least now) using Spring-security. Sadly this is a deal breaker for
>>> me :S
>>>
>>> The nice thing is that thanks to tapestry modularity it was extremely
>>> easy to replace the security to use Chennilleit Access! I am really
>>> looking forward for CK new release :)
>>>
>>> On Wed, Jul 15, 2009 at 9:04 AM, Juan E. Maya<maya.j...@gmail.com> wrote:
>>>> Does anybody has found a way to unit test pages of an application that
>>>> use Tapestry-Spring Security?
>>>>
>>>> I always get the error:
>>>>
>>>>
>>>> java.lang.RuntimeException: java.io.IOException: Can only process
>>>> HttpServletRequest
>>>>        at 
>>>> org.apache.tapestry5.test.PageTester.renderPage(PageTester.java:200)
>>>>        at 
>>>> com.rinco.misacas.web.test.SimplePageTest.simpleTest(SimplePageTest.java:53)
>>>>        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:580)
>>>>        at org.testng.internal.Invoker.invokeMethod(Invoker.java:478)
>>>>        at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:617)
>>>>        at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:885)
>>>>        at 
>>>> org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126)
>>>>        at 
>>>> org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:110)
>>>>        at org.testng.TestRunner.runWorkers(TestRunner.java:712)
>>>>        at org.testng.TestRunner.privateRun(TestRunner.java:582)
>>>>        at org.testng.TestRunner.run(TestRunner.java:477)
>>>>        at org.testng.SuiteRunner.runTest(SuiteRunner.java:324)
>>>>        at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:319)
>>>>        at org.testng.SuiteRunner.privateRun(SuiteRunner.java:292)
>>>>        at org.testng.SuiteRunner.run(SuiteRunner.java:198)
>>>>        at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:823)
>>>>        at org.testng.TestNG.runSuitesLocally(TestNG.java:790)
>>>>        at org.testng.TestNG.run(TestNG.java:708)
>>>>        at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
>>>>        at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:124)
>>>> Caused by: java.io.IOException: Can only process HttpServletRequest
>>>>        at 
>>>> nu.localhost.tapestry5.springsecurity.services.internal.RequestFilterWrapper.service(RequestFilterWrapper.java:64)
>>>>        at 
>>>> $RequestHandler_1227d30e8e4.service($RequestHandler_1227d30e8e4.java)
>>>>        at 
>>>> com.rinco.misacas.web.services.MisacasModule$1.service(MisacasModule.java:109)
>>>>        at 
>>>> $RequestFilter_1227d30e8e0.service($RequestFilter_1227d30e8e0.java)
>>>>        at 
>>>> $RequestHandler_1227d30e8e4.service($RequestHandler_1227d30e8e4.java)
>>>>        at 
>>>> org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26)
>>>>        at 
>>>> $RequestHandler_1227d30e8e4.service($RequestHandler_1227d30e8e4.java)
>>>>        at 
>>>> org.apache.tapestry5.services.TapestryModule$4.service(TapestryModule.java:778)
>>>>        at 
>>>> $RequestHandler_1227d30e8e4.service($RequestHandler_1227d30e8e4.java)
>>>>        at 
>>>> org.apache.tapestry5.services.TapestryModule$3.service(TapestryModule.java:767)
>>>>        at 
>>>> $RequestHandler_1227d30e8e4.service($RequestHandler_1227d30e8e4.java)
>>>>        at 
>>>> org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:85)
>>>>        at 
>>>> $RequestHandler_1227d30e8e4.service($RequestHandler_1227d30e8e4.java)
>>>>        at 
>>>> org.apache.tapestry5.internal.test.EndOfRequestCleanupFilter.service(EndOfRequestCleanupFilter.java:42)
>>>>        at 
>>>> $RequestHandler_1227d30e8e4.service($RequestHandler_1227d30e8e4.java)
>>>>        at 
>>>> org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:90)
>>>>        at 
>>>> org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:81)
>>>>        at 
>>>> org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:85)
>>>>        at 
>>>> org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:103)
>>>>        at 
>>>> $RequestHandler_1227d30e8e4.service($RequestHandler_1227d30e8e4.java)
>>>>        at 
>>>> $RequestHandler_1227d30e8b9.service($RequestHandler_1227d30e8b9.java)
>>>>        at 
>>>> org.apache.tapestry5.test.PageTester.renderPage(PageTester.java:173)
>>>>        ... 23 more
>>>> Caused by: javax.servlet.ServletException: Can only process 
>>>> HttpServletRequest
>>>>        at 
>>>> org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:46)
>>>>        at 
>>>> nu.localhost.tapestry5.springsecurity.services.internal.RequestFilterWrapper.service(RequestFilterWrapper.java:55)
>>>>        ... 44 more
>>>>
>>>> After running a test like this:
>>>>
>>>>       @Test
>>>>        public void simpleTest() {
>>>>                private  PageTester MISACAS_tester_TESTER = new
>>>> PageTester(APP_NAME, APP_PACKAGE, APP_CONTEXT);
>>>>                Document doc = tester.renderPage("Index");
>>>>                Assert.notNull(doc.getElementById("featuredItems"));
>>>>        }
>>>>
>>>> Of course this is natural, as HTTP is not being used to render the
>>>> pages during test, what would like to know is if it's possible to
>>>> avoid the execution of the Security RequestHandler ? I though about
>>>> overriding the handler for tests or forcing the test to avoid loading
>>>> the security module but i haven't been able to achieve any of those :S
>>>>
>>>> Any ideas?
>>>>
>>>> Thanks a lot!
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to