[EMAIL PROTECTED] wrote on 06/09/2005 10:20:00 PM:

> Hi all.
>
> I would like to call a test from inside another test, so that I can
> perform some actions which are shared between different tests.
>
> If I understand correctly, there is no way of doing this. Should I
> write my test as a doSomething extension, and write all my shared
> parts inside it?
>
> Let's say I've a test testLogin like:
>
> open | anUrl|
> type | username| pluto |
> type | password | pluto |
> clickAndWait | submit |
> verifyLocation | anotherUrl |
>
> can I create a login command, and write inside it:
>
> ... doLogin = function(locator, text) {
> doOpen(anUrl);
> doType('username', 'pluto');
> doType('password', 'pluto');
> doClickAndWait('submit');
> verifyLocation('anotherUrl');
> }
>
> or what could be the syntax?

Selenium's execution model makes this sort of thing hard.

For starters, the "AndWait" qualifier is part of the execution loop and cannot be buried inside another action.
You may find that you can combine a number of simple actions (such as the first three in your function), but generally this approach is limited.

On a couple of projects we have used jsp includes to group together common combinations of actions (what can work well is having an include or jsp tag for each page you are testing parameterized with the values you want to use to fill in fields).

Cheers,
David

David Kemp
ThoughtWorks Australia Pty Ltd
http://www.thoughtworks.com


_______________________________________________
Selenium-users mailing list
Selenium-users@lists.public.thoughtworks.org
http://lists.public.thoughtworks.org/mailman/listinfo/selenium-users

Reply via email to