One option is to have a setup test that you guarantee executes first.
Something like

def test_aaa_setup_environment
 # do initial setup for the upcoming tests
end

You could of course do something similar for teardown like

def test_zzz_teardown_environment
 # do teardown stuff
end

This works because Test::Unit executes tests in alphabetical order...but
there may be more elegant solutions as well. If folks know of them, please
speak up.

One thing I wouldn't recommend in general is to just put the initial steps
in the current first test in your suite. This might be fine but seems
fragile. If something else becomes the new first test, you'll need to copy
code to the new test.

Jeff

On 6/26/07, Manish Sapariya <[EMAIL PROTECTED]> wrote:

Jeff Fry wrote:
> Happily, setup and teardown are also optional methods for those of us
> using Watir. If you don't want something to happen automatically at
> the beginning of every run, don't put it in setup. Likewise with
> teardown. For functional automation I often don't include these
> methods at all.
Thanks Jeff.
How about the case when I want to setup some environment, but that needs
to be done only once for a set of test cases.

Regards,
Manish
_______________________________________________
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general




--
http://testingjeff.wordpress.com
_______________________________________________
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to