Hi Ben

I haven't tried Sathya Shankar's method but the one I use follows

You can do this by placing them in a file and requiring it at the
beginning of the script

All my variables for a web site I'm testing are held in the file
'C:\RubyScripts\my\folder\setup'

To load this when the script kicks off I place <<require
'C:\RubyScripts\my\folder\setup'>> before the script body but after the
<<include 'watir'>> line 

So the top of the script looks like this

require 'watir'
include Watir 

require 'C:\RubyScripts\my\folder\setup' # all set up Var for this
script
require 'C:\RubyScripts\my\folder\CustomMethods'# Custom Method Calls

(You can also do this with custom methods that you will need in multiple
scripts, that's what the last line is)

The file 'C:\RubyScripts\my\folder\setup' is pretty much just a list of
stuff like

$myVar1 = A
$myVar2 = 'Zebedee'
$myArr1 = [1, 2, 3, 4, 5]
Etc



Hope this helps

Malcolm Beaton
Technical Consultant
Conchango
'Innovative Change in Business' 

D +44 (0) 1784 222127
S +44 (0) 1784 222222
M +44 (0) 777 071 3121 

[EMAIL PROTECTED]
http://www.conchango.com

No.2 New Media Age - Top 10 Technology Agencies 2004
No.5 New Media Age - Top 20 Interactive Agencies 2004
No.3 Marketing - Top 100 New Media Agencies 2005

Winner - Best Travel Website - New Media Age 2005
Winner - Best Retail Website - British Interactive Media Association
(BIMA) 2004
Winner - Information Management Business Intelligence Project of the
Year 2003
Winner - Microsoft European Business Intelligence Solutions Award 2003
More awards >

 


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Torres, Ben
(HQP)
Sent: 30 December 2005 21:54
To: [email protected]
Subject: [Wtr-general] Keeping all global variable in a file

Hi,

Can I keep all my global variables in a separate file from my script
files and have several script files use these variables?  If so, how?

Thanks in advance,
Ben


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

_____________________________________________________________________
This e-mail has been scanned for viruses by MessageLabs. The information 
contained in this message is confidential and is intended for the addressee 
only. If you have received this message in error, please notify Conchango plc 
as soon as possible. The unauthorised use, disclosure, copying or alteration of 
this message is prohibited and may be unlawful. The internet cannot guarantee 
the integrity of this message and therefore Conchango plc will not be liable 
for the message if modified.  

Reg. Heritage House, Church Road, Egham, Surrey, TW20 9QD T 44 (0) 1784 222 222 
F 44 (0) 1784 222 200 E [EMAIL PROTECTED]  No. 2598884

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

Reply via email to