Hello,
I am tryning to make my Watir data-driven test automation script more
object oriented and thus more reusabel across applications.
Doing this I want to make two methods, one to connect, and one to
disconnect Excel:

  def connect()
  excel = WIN32OLE::new("excel.Application")
  workbook = excel.Workbooks.Open("C:\\Programfiler\\Ruby\
\FPSdata.xls")
  worksheet = workbook.WorkSheets(1)
  puts "You are now connected to Excel"
  end

 def disconnect()
  workbook.Close
  excel.Quit
  puts "You are now disconnected from Excel"
  end

But I run into problems. I want ot parameterize these methods like
this:

# The Constructor
def initialize()
  excel = WIN32OLE::new("excel.Application")
  workbook = excel.Workbooks.Open("C:\\Programfiler\\Ruby\
\FPSdata.xls")
end


  def connect(workbook)
  worksheet = workbook.WorkSheets(1)
  puts "You are now connected to Excel"
  end


# do something...


 def disconnect(workbook)
  workbook.Close
  excel.Quit
  puts "You are now disconnected from Excel"
  end


But is it possible to parameterize a method with an object (workbook)?

Any other ways to do this?

Cheers
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to [email protected]
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to