There is usually a clean way to build something into an object instead
of simply blasting things to a global variable.

If all of your tests are within a single TestCase object, then you can
easily use instance variables for that class ( @blah ) and then all of
the methods within that instance object will have access.

Beyond that, if you have multiple separate TestCase objects then you
either need to use something like a global ( even if that global is
simply an object to hold your real globals ... still not the
recommended solution ... globals are almost always sloppy ) or maybe
serialize your values out to environment variables or a properties
file and have each class load it... ( Think YAML! )

Those are the options I would use... Hope that helps.

j.


On 8/26/05, Jonathan Kohl <[EMAIL PROTECTED]> wrote:
> +1
> 
> Use extreme caution with global variables. :)
> 
> -Jonathan
> 
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of Kingsley
> > Sent: August 26, 2005 1:08 PM
> > To: [email protected]
> > Subject: RE: [Wtr-general] Passing data between scirpts?
> >
> > Or a class variable @@var
> >
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of Zeljko Filipin
> > Sent: 26 August 2005 10:45
> > To: [email protected]
> > Subject: Re: [Wtr-general] Passing data between scirpts?
> >
> > Global variable is any variable that starts with $ (like
> > $my_global_variable).
> >
> > Zeljko
> >
> > 2005/8/26, Ian Phillips <[EMAIL PROTECTED]>:
> > > Hi.
> > >
> > > Just started using WATIR and have hit this problem.  I need
> > to pass a
> > > variable or have a global variable so that all my scripts
> > have access
> > > to it.  Is this possible?
> > >
> > > I have a port number that can change each time I start my app so I
> > > want to be able to change this value in one place.
> > >
> > > Any helps or links would be useful.
> > >
> > > Thanks
> > >
> > > Ian Phillips
> > >
> > > _______________________________________________
> > > Wtr-general mailing list
> > > [email protected]
> > > http://rubyforge.org/mailman/listinfo/wtr-general
> > >
> >
> > _______________________________________________
> > Wtr-general mailing list
> > [email protected]
> > http://rubyforge.org/mailman/listinfo/wtr-general
> >
> >
> > _______________________________________________
> > Wtr-general mailing list
> > [email protected]
> > http://rubyforge.org/mailman/listinfo/wtr-general
> >
> 
> _______________________________________________
> Wtr-general mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/wtr-general
> 


-- 
"So long, and thanks for all the fish"

Jeff Wood

_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to