[wtr-general] Re: Help with class,method,objects

2009-07-31 Thread marekj

if this is the method def

def login(ie)
 login script
 text_field.set(adunme)
 text_field.set(adpwd)
end

then can you explain the line by line intention of this code?





Watirloo: Semantic Page Objects in UseCases
http://github.com/marekj/watirloo/




On Thu, Jul 30, 2009 at 10:29 PM, Rohan Ojharohan.o...@bsil.com wrote:
 Hi,



 Yaa I am using the same but I have modified it for my usage.



 What I do is :



 class Tax_CheckMapping

 def returnExcelData(file,range)

     @range=range

     @file=file

     taxChkOpr=[]

     excelObject=Excel.new

     excelData=excelObject.getRowData(@file,'SCENARIOS-TESTDATA',@range)

     incr_i=0

     excelData.each do |oneRow|



   taxChkOpr[incr_i]=Tax_CheckOperation.new

   taxChkOpr[incr_i].setUserData(oneRow['Admin User
 Name'].to_s,oneRow['Admin Password'].to_s )

   incr_i=incr_i+1



     end

     return taxChkOpr

   end



 end



 And in the second class I do the following operations :



 class Tax_CheckOperation



 attr_reader :adunme,:adpwd



 def intialize



     @adunme=

     @adpwd=

 end



 def setUserData(adunme,adpwd)

 @adunme=adunme

 @adpwd=adpwd

 end



 def login(ie)

  login script

 text_field.set(adunme)

 text_field.set(adpwd)

 end



 end





 Whearas in my script :



 taxChkMapper=Tax_CheckMapping.new

 taxChkOpr=taxChkMapper.returnExcelData(path of the excel file,’TC1’)
  TC1 is my identifier for test cases



 taxChkOpr.each do |eachIns|

 eachIns.login(ie)

 end



 So per say if my login method is not defined in the class Tax_CheckOperation
 I wont be able to access my variables ‘adunme’ and ‘adpwd’.



 I have also used the ‘’send’’ method as well but that’s not being fruitful
 either,



 Hope now the things are clearer for you guys to help me. Since I am not
 calling the method with the object of the class but instance of an array
 object.



 Thanks

 Rohan Ojha









 -Original Message-
 From: watir-general@googlegroups.com [mailto:watir-gene...@googlegroups.com]
 On Behalf Of George
 Sent: Friday, July 31, 2009 8:39 AM
 To: Watir General
 Subject: [wtr-general] Re: Help with class,method,objects





 Are you using the Excel interface class from Watir's site?



 http://wiki.openqa.org/display/WTR/Excel+interface+class





 On Jul 29, 9:57 pm, Rohan Ojha rohan.o...@bsil.com wrote:

 Hi All,



 I am not too sure whether I should post it here or in a Ruby forum.



 But there is a problem that I am facing while scripting a data driven
 Watir

 suite.



 1)       I have a class (say the base class) wherein I am fetching data
 from

 excel and storing them in a variable.



 2)       Now there's a generic method in the application which is stored
 in

 another Ruby file (not in a  class, not in a module)



 3)       I need to call this generic method with the object of the base

 class (since the object has the data allotted to the variables)



 4)       But when I do this it says   undefined method `methodName' for

 main:Object.



 So can somebody help me with this? What can I do so that I can access the

 methods and at the same time the data is set to variables for every row of

 excel sheet.



 Thanks in advance.



 Thanks,

 Rohan Ojha

  Blue Star Infotech l*+91 900 4955058l * +91 22 6688 6969 l 6 +91 22 6688

 6999 l *  mailto:rohan.o...@bsil.com rohan.o...@bsil.com

    http://www.bsil.com/www.bsil.com- Where Partnerships Are Built on

 Trust

 


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



[wtr-general] Re: Help with class,method,objects

2009-07-30 Thread George

Are you using the Excel interface class from Watir's site?

http://wiki.openqa.org/display/WTR/Excel+interface+class


On Jul 29, 9:57 pm, Rohan Ojha rohan.o...@bsil.com wrote:
 Hi All,

 I am not too sure whether I should post it here or in a Ruby forum.

 But there is a problem that I am facing while scripting a data driven Watir
 suite.

 1)       I have a class (say the base class) wherein I am fetching data from
 excel and storing them in a variable.

 2)       Now there's a generic method in the application which is stored in
 another Ruby file (not in a  class, not in a module)

 3)       I need to call this generic method with the object of the base
 class (since the object has the data allotted to the variables)

 4)       But when I do this it says   undefined method `methodName' for
 main:Object.

 So can somebody help me with this? What can I do so that I can access the
 methods and at the same time the data is set to variables for every row of
 excel sheet.

 Thanks in advance.

 Thanks,
 Rohan Ojha
  Blue Star Infotech l*+91 900 4955058l * +91 22 6688 6969 l 6 +91 22 6688
 6999 l *  mailto:rohan.o...@bsil.com rohan.o...@bsil.com
    http://www.bsil.com/www.bsil.com- Where Partnerships Are Built on
 Trust
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Watir General group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Help with class,method,objects

2009-07-30 Thread Rohan Ojha
Hi,

 

Yaa I am using the same but I have modified it for my usage.

 

What I do is :

 


class Tax_CheckMapping

def returnExcelData(file,range)

@range=range

@file=file

taxChkOpr=[]

excelObject=Excel.new

excelData=excelObject.getRowData(@file,'SCENARIOS-TESTDATA',@range)

incr_i=0

excelData.each do |oneRow|

  

  taxChkOpr[incr_i]=Tax_CheckOperation.new

  taxChkOpr[incr_i].setUserData(oneRow['Admin User
Name'].to_s,oneRow['Admin Password'].to_s )

  incr_i=incr_i+1

  

end

return taxChkOpr

  end

  

end

 

And in the second class I do the following operations :

 


class Tax_CheckOperation

 

attr_reader :adunme,:adpwd

 

def intialize



@adunme=

@adpwd=

end

 

def setUserData(adunme,adpwd)

@adunme=adunme

@adpwd=adpwd

end

 

def login(ie)

 login script

text_field.set(adunme)

text_field.set(adpwd)

end

 

end

 

 

Whearas in my script :

 


taxChkMapper=Tax_CheckMapping.new

taxChkOpr=taxChkMapper.returnExcelData(path of the excel file,'TC1')
TC1 is my identifier for test cases

 

taxChkOpr.each do |eachIns|

eachIns.login(ie)

end

 

So per say if my login method is not defined in the class Tax_CheckOperation
I wont be able to access my variables 'adunme' and 'adpwd'.

 

I have also used the ''send'' method as well but that's not being fruitful
either,

 

Hope now the things are clearer for you guys to help me. Since I am not
calling the method with the object of the class but instance of an array
object.

 

Thanks

Rohan Ojha

 

 

 

 

-Original Message-
From: watir-general@googlegroups.com [mailto:watir-gene...@googlegroups.com]
On Behalf Of George
Sent: Friday, July 31, 2009 8:39 AM
To: Watir General
Subject: [wtr-general] Re: Help with class,method,objects

 

 

Are you using the Excel interface class from Watir's site?

 

http://wiki.openqa.org/display/WTR/Excel+interface+class

 

 

On Jul 29, 9:57 pm, Rohan Ojha rohan.o...@bsil.com wrote:

 Hi All,

 

 I am not too sure whether I should post it here or in a Ruby forum.

 

 But there is a problem that I am facing while scripting a data driven
Watir

 suite.

 

 1)   I have a class (say the base class) wherein I am fetching data
from

 excel and storing them in a variable.

 

 2)   Now there's a generic method in the application which is stored
in

 another Ruby file (not in a  class, not in a module)

 

 3)   I need to call this generic method with the object of the base

 class (since the object has the data allotted to the variables)

 

 4)   But when I do this it says   undefined method `methodName' for

 main:Object.

 

 So can somebody help me with this? What can I do so that I can access the

 methods and at the same time the data is set to variables for every row of

 excel sheet.

 

 Thanks in advance.

 

 Thanks,

 Rohan Ojha

  Blue Star Infotech l*+91 900 4955058l * +91 22 6688 6969 l 6 +91 22 6688

 6999 l *  mailto:rohan.o...@bsil.com rohan.o...@bsil.com

http://www.bsil.com/www.bsil.com- Where Partnerships Are Built on

 Trust



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