Title: RE: [Wtr-general] Modula test execution?

Is it possible to have one global variable across multiple files?
In the example below "$ie" is the global variable in the file "open.rb".


File: Login:
#Includes
    require 'watir'   # the watir controller
    include Watir
    require 'open'
    require 'Login'         #login include

File: open.rb:  
    def start   #open the IE browser
      $ie = IE.new
    end

    #call start method...
    start
 
    $ie.goto(logIN.url)
 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Chris McMahon
Sent: Tuesday, January 24, 2006 12:41 PM
To: [email protected]
Subject: Re: [Wtr-general] Modula test execution?

> I am new to ruby and watir, so this might be a very trivial question.

Welcome!

>
> Is there a elegant solution to have a modular test script approach?
>
> I have blocks of code that will be always the same for the web-site I
> am going to test, like "login", "search", "logout", etc. So my idea is
> to put those modules into separate files and then call them from a
> script called "testExecution.rb". What is your solution?

This is a classic refactoring exercise.  Look up "Module" in the Pickaxe, or look around at the Watir distro for some fairly advanced examples.  (I'm doing this right now on my current project, once you start, you'll get the hang of it quickly.) -Chris

_______________________________________________
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

Reply via email to