Albatross: How should I access the model?

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

Albatross: How should I access the model?

Matthias Berth-2
Hello,

in the Albatross paper [1] there is a section about "Model access" (p 15):

> There is unlimited access to the
> model available by the test component accessor ATestCase>>testComponent. Depending
> on the test components code, we may access the model with self testComponent model
> or likewise. The model access can be useful for assertions before and after user interactions.

I'd like to do just that, e.g. accessing the Pier kernel after I have
added / removed a page. The method testComponent seems to have
migrated to AComponentWrapper, looking at its senders does not help.
All the example tests seem to deal only with user interactions
(browser click: etc).

So, how do I access the model from inside an Albatross unit test?


Cheers

Matthias

[1] http://www.iam.unibe.ch/~scg/Archive/Projects/Brue06a.pdf
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Albatross: How should I access the model?

Adrian Lienhard
Hi Matthias,

Apparently this got lost in a recent refactoring.
In Albatross-al.215 you can access the root component instance from a  
unit test. As an example see APierTest>>testEditPage.

This version of Albatross also allows one to easily access to the  
current URL and title as you requested in another mail.

Cheers,
Adrian


On Feb 29, 2008, at 09:51 , Matthias Berth wrote:

> Hello,
>
> in the Albatross paper [1] there is a section about "Model  
> access" (p 15):
>
>> There is unlimited access to the
>> model available by the test component accessor  
>> ATestCase>>testComponent. Depending
>> on the test components code, we may access the model with self  
>> testComponent model
>> or likewise. The model access can be useful for assertions before  
>> and after user interactions.
>
> I'd like to do just that, e.g. accessing the Pier kernel after I have
> added / removed a page. The method testComponent seems to have
> migrated to AComponentWrapper, looking at its senders does not help.
> All the example tests seem to deal only with user interactions
> (browser click: etc).
>
> So, how do I access the model from inside an Albatross unit test?
>
>
> Cheers
>
> Matthias
>
> [1] http://www.iam.unibe.ch/~scg/Archive/Projects/Brue06a.pdf
> _______________________________________________
> 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
Reply | Threaded
Open this post in threaded view
|

Re: Albatross: How should I access the model?

Matthias Berth-2
Aaah, thanks! I thought that Albatross-al.215 was an old version, and
I was just about to try to merge that... :-)

So, for everyone else who's reading - in the current version of
Albatross you can:

1) get the component under test using ATestCase>>getTestComponent. The
component then might give you the model, as in
  APierTest>>testEditPage
      "We edited a pier page through the web browser, check if the
model changed accordingly."
      page := self getTestComponent context structure.
      "page is a PRPage (model object), check its title and contents"
        self assert: page title = 'Hello world!'.
        self assert: page contents = 'This is the first Albatross Pier test
in the world!'

2) get the current URL using ABrowser>>url

3) get the title of the HTML page using ABrowser>>title

Thanks Adrian!


Matthias


On Sun, Mar 2, 2008 at 6:40 PM, Adrian Lienhard <[hidden email]> wrote:

> Hi Matthias,
>
>  Apparently this got lost in a recent refactoring.
>  In Albatross-al.215 you can access the root component instance from a
>  unit test. As an example see APierTest>>testEditPage.
>
>  This version of Albatross also allows one to easily access to the
>  current URL and title as you requested in another mail.
>
>  Cheers,
>  Adrian
>
>
>
>
>  On Feb 29, 2008, at 09:51 , Matthias Berth wrote:
>
>  > Hello,
>  >
>  > in the Albatross paper [1] there is a section about "Model
>  > access" (p 15):
>  >
>  >> There is unlimited access to the
>  >> model available by the test component accessor
>  >> ATestCase>>testComponent. Depending
>  >> on the test components code, we may access the model with self
>  >> testComponent model
>  >> or likewise. The model access can be useful for assertions before
>  >> and after user interactions.
>  >
>  > I'd like to do just that, e.g. accessing the Pier kernel after I have
>  > added / removed a page. The method testComponent seems to have
>  > migrated to AComponentWrapper, looking at its senders does not help.
>  > All the example tests seem to deal only with user interactions
>  > (browser click: etc).
>  >
>  > So, how do I access the model from inside an Albatross unit test?
>  >
>  >
>  > Cheers
>  >
>  > Matthias
>  >
>  > [1] http://www.iam.unibe.ch/~scg/Archive/Projects/Brue06a.pdf
>  > _______________________________________________
>  > 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
>
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside