SeasideTesting: Access session from component

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

SeasideTesting: Access session from component

Jan-Felix Schwarz
Hello,

I want to use SeasideTesting to test my components. I have overriden the Session class and access the customized session class from my components. Application runs fine in web browser.

While excecuting the test cases I get errors because calling session from the component returns UndefinedObject. I know I get the session by calling 'self session' from the test class. But for reasonable unit testing I need my component's methods to work properly. Anyone knows how to fix this problem?

Sorry for my bad English. Thanks for your help.

Felix
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: SeasideTesting: Access session from component

cdavidshaffer
Schwarz, Jan-Felix wrote:

> Hello,
>
> I want to use SeasideTesting to test my components. I have overriden the Session class and access the customized session class from my components. Application runs fine in web browser.
>
> While excecuting the test cases I get errors because calling session from the component returns UndefinedObject. I know I get the session by calling 'self session' from the test class. But for reasonable unit testing I need my component's methods to work properly. Anyone knows how to fix this problem?
>
> Sorry for my bad English. Thanks for your help.
>
> Felix
>  

http://www.shaffer-consulting.com/david/Seaside/TestingComponents/TestingComponents.html

Then just search for the text "sessionClass".  If that doesn't help, let
me know.

David

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

AW: SeasideTesting: Access session from component

Jan-Felix Schwarz
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.

Thank you for your help.
Felix

-----Ursprüngliche Nachricht-----
Von: [hidden email] im Auftrag von C. David Shaffer
Gesendet: So 13.01.2008 22:08
An: Seaside - general discussion
Betreff: Re: [Seaside] SeasideTesting: Access session from component
 
Schwarz, Jan-Felix wrote:

> Hello,
>
> I want to use SeasideTesting to test my components. I have overriden the Session class and access the customized session class from my components. Application runs fine in web browser.
>
> While excecuting the test cases I get errors because calling session from the component returns UndefinedObject. I know I get the session by calling 'self session' from the test class. But for reasonable unit testing I need my component's methods to work properly. Anyone knows how to fix this problem?
>
> Sorry for my bad English. Thanks for your help.
>
> Felix
>  
http://www.shaffer-consulting.com/david/Seaside/TestingComponents/TestingComponents.html

Then just search for the text "sessionClass".  If that doesn't help, let
me know.

David

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

winmail.dat (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: AW: SeasideTesting: Access session from component

cdavidshaffer
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

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside