AW: [Seaside] SeasideTesting: Access session from component

C. David Shaffer cdshaffer at acm.org
Mon Jan 14 14:47:35 UTC 2008


Schwarz, Jan-Felix wrote:
> I am familiar with your nice tutorial. I don't get it to run anyway. So here is an excerpt of my test code:
>
> SCComponentTestCase subclass: #WWComponentTestCase>>
> configureApplicationForComponent: aComponentClass
>
> 	super configureApplicationForComponent: aComponentClass.
> 	app preferenceAt: #sessionClass put: WWSession.
>
>
> WWComponentTestCase subclass: #WWStartComponentTest>>
> testXYZ
>         self newApplicationWithRootClass: WWStartComponent.
> 	self establishSession.
>         self component session isLoggedIn.
>
> This raises an OndefinedObject(Object)>>doesNotUnderstand: #isLoggedIn exception.
>
>   
The method WAComponent>>session uses a dynamically-scoped variable to 
access the current session.  Seaside testing does not bind that variable 
in the call stack of the test case.  I do provide a way to get it 
though: SCComponentTestCase>>session will return the current session so 
if you change your code to "self session isLoggedIn" it should work.

David



More information about the seaside mailing list