Thanks for the answer! I had tried something like it but it didn't
work so I thought I'd ask. Turns out I had just written wrong.
Since the login is saved in the session I only have to log in once per
test-class, this seems to work fine. Did something like this:

public class TestBase extends TelluriumJavaTestCase {
    @BeforeClass public static void initBase() {
        loginPage.defineUi();
        connectUrl( server + "/login.html");
        loginPage.doLogin( "user1", "pass1");
        assertTrue( loginPage.getLocation().startsWith( server + "/
main.html") );
    }
}
public class MainTest extends TestBase {
      @Test TestsRUs!
}

Regards
/Ernst

On Apr 22, 11:40 am, Haroon Rasheed <[email protected]> wrote:
> Hi,
>
> You will have multiple class files for the pages, and  you can call the
> defineUI for all the pages involved in the tests only once within the setup
> method.
>
> e.g. you are testing the login functionality. So you will have 2 classes in
> the UI module.
>
> LoginPage.groovy
> WelcomePage.groovy
>
> @BeforeClass
> public void setup(){
>     loginPage.defineUI();
>     welcomePage.defineUI();
>
> }
>
> @Test
> public void testLogin(){
>     loginPage.login(username, password);
>     assertTrue(welcomePage.getWelcomeMessageExist());
>
> }
>
> @Test
> public void testLogout(){
>    // You can reuse the object here without calling the defineUI again.
>     loginPage...
>     welcomePage..
>
> }
>
> You can call the defineUI for both of these pages within the setup method
> and then use the objects throughout your tests. you will not loose the
> objects on the page refresh as it happens with some of the test automation
> tools where you loose the context of the object if the page is refreshed.
>
> I hope this helps, please feel free to contact in case of any question.
>
> Haroon
>
> 2009/4/22 Ernst <[email protected]>
>
>
>
> > Hi,
>
> > does anyone have a suggestion for how to design (and if it works?!) a
> > test spanning multiple pages.
> > I have an old selenium test that does the following:
> > open /login.html
> > type username user1
> > type password pass1
> > clickAndWait button
> > /// Now it will go to another page, and the test continues
> > click
> > type
> > and so on...
>
> > I guess I need a call to defineUI() inside the tests after each time a
> > new page is loaded...?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"tellurium-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/tellurium-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to