HI Tiffany

Thanks for your reply

 Still am getting error saying

error:  /nnn.rb:36: warning: parenthesize argument(s) for future
version
./nnn.rb:26: undefined local variable or method `dirrectory' for
main:Object (NameError)
        from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
        from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'

i have changed the code accordingly as your suggestion

require 'win32ole'
require 'watir'
require 'Xls'


xlFile = XLS.new('C:\irma1.xls') #grab the data file in the same
dirrectory
myData = xlFile.getRowRecords('Inspection Search Data','Search')
#pull data records  from excel
xlFile.close
myData.each do |record|
def searchinspections()
       $ie.link(:href, "http://qa.irma.icat.com/inspwebapp/
inspectionSearchInit.do").click
       $ie.button(:name, "clearCriteriaBtn").click
       $ie.radio(:index, 2).set
       puts $record['PolicyNumber']
       $ie.text_field(:name, "PolicyNumber").set(record
['PolicyNumber'])   #error occured here
       $ie.button(:name, "submitBtn").click
       if $ie.contains_text(record['ContainsText'])
        puts "Results of search: '#{record['PolicyNumber']}' contains
'#{record['ContainsText']}'"
       else
       puts "Error: could not find text: '#{record['ContainsText']}'
in results of search: '#{record['PolicyNumber']}'"
       end
       sleep 3
       return $ie

       end
end


Actually am not understanding the basics of how to parameterize the
testcaes,In my application i have to parameterize for search option
where user should be able to search with different data like with
InspectionID,PolicyNumber,Status,Priority

Can you suggest with sample code how i can do this?
On Apr 2, 9:33 am, Tiffany Fodor <tcfo...@comcast.net> wrote:
> I just took another look at your code in your second post - you're
> using a global variable '$record' where you should be using 'record'.
> These are entirely different variables and the fact that they both
> have the text 'record' does not connect them in any way.
>
> The error in your first post of this thread is likely because you
> don't have a worksheet named 'Setup' in your excel spreadsheet.
>
> On Apr 1, 10:21 pm, Tiffany Fodor <tcfo...@comcast.net> wrote:
>
>
>
> > Hi!
>
> > Have you done any troubleshooting on what you have stored in $record?
> > You might start by adding the following before the line that's causing
> > the problem to make sure the value you're trying to set isn't nil.
>
> > puts $record['PolicyNumber']
>
> > Hope this helps!
>
> > -Tiffany
>
> > On Apr 1, 10:08 pm, Shweta <nagman...@gmail.com> wrote:
>
> > > Hi Jim
>
> > > Still am getting the same error at this line
>
> > > $ie.text_field(:name, "PolicyNumber").value = ($record
> > > ['PolicyNumber'])
>
> > > error:  ./SearchInspection.rb:39:in `searchinspections': undefined
> > > method `[]' for nil:NilClass (NoMethodError)
>
> > > On Apr 1, 8:21 pm, Jim Matthews <jim_m...@swbell.net> wrote:
>
> > > > Shweta,
>
> > > >        $ie.text_field(:name, "PolicyNumber").set($record
> > > > ['PolicyNumber'])   #error occured here
>
> > > > If you are trying to put a value in a text_field, you need to use
> > > > value, so your line would look something like this:
>
> > > >        $ie.text_field(:name, "PolicyNumber").value = ($record
> > > > ['PolicyNumber'])
>
> > > > Jim
>
> > > > On Apr 1, 7:06 am, Shweta <nagman...@gmail.com> wrote:
>
> > > > > Hi
>
> > > > > Am getting error in the line where i put the comment has #error
> > > > > occured here
>
> > > > > require 'win32ole'
> > > > > require 'watir'
> > > > > require 'Xls'
>
> > > > > xlFile = XLS.new('C:\irma1.xls') #grab the data file in the same
> > > > > dirrectory
> > > > > myData = xlFile.getRowRecords('Inspection Search Data','Search')
> > > > > #pull data records  from excel
> > > > > xlFile.close
> > > > > myData.each do |record|
> > > > > def searchinspections()
> > > > >        $ie.link(:href, "http://searchrecord/
> > > > > inspectionSearchInit.do").click
> > > > >        $ie.button(:name, "clearCriteriaBtn").click
> > > > >        $ie.radio(:index, 2).set
> > > > >        $ie.text_field(:name, "PolicyNumber").set($record
> > > > > ['PolicyNumber'])   #error occured here
> > > > >        $ie.button(:name, "submitBtn").click
> > > > >        if $ie.contains_text(record['ContainsText'])
> > > > >         puts "Results of search: '#{record['PolicyNumber']}' contains
> > > > > '#{record['ContainsText']}'"
> > > > >        else
> > > > >        puts "Error: could not find text: '#{record['ContainsText']}'
> > > > > in results of search: '#{record['PolicyNumber']}'"
> > > > >        end
> > > > >        sleep 3
> > > > >        return $ie
> > > > >        $ie.close
> > > > >        end
> > > > > end
>
> > > > > and am calling in other test as
>
> > > > > require 'win32ole'
> > > > > require 'watir'
> > > > > require 'Login_irma'
> > > > > require 'test/unit/assertions'
> > > > > require 'watir/assertions'
> > > > > require 'SearchInspection'
>
> > > > > $ie = login("mtedfhhh","password")
> > > > > $ie = searchinspections()
>
> > > > > Can anyone suggest whats wrong here
>
> > > > > On Apr 1, 2:41 pm, Shweta <nagman...@gmail.com> wrote:
>
> > > > > > Hi
>
> > > > > > Am trying to parameterizing my test cases am getting some error,am 
> > > > > > not
> > > > > > understanding where am wrong i have gone thru the posts regarding 
> > > > > > this
> > > > > > i dint get any idea,Can anyone pls let me know whats wrong here
>
> > > > > > My code:
>
> > > > > > require 'watir'
> > > > > > require 'watir/testcase'
> > > > > > require 'watir/assertions'
> > > > > > require 'test/unit'
> > > > > >  require 'LogIn'
> > > > > > begin
> > > > > >     xlFile = XLS.new('C:\\MA.xls')
>
> > > > > >     $Policynumber = xlFile.getColumnRecords('B4:C6', 'Ponumber')
> > > > > >     setupInfo = xlFile.getHash('A1:B4', 'Setup')
> > > > > >     $runTests = xlFile.getHash('A13:B27', 'Setup')
> > > > > > ensure
> > > > > >     xlFile.close
> > > > > > end
>
> > > > > > $test_site = setupInfo['URL']
> > > > > > $UserName = setupInfo['Username']
> > > > > > $UserPass = setupInfo['Password']
>
> > > > > > #get today's date for use in scripts
> > > > > > $today = "#{Time.now.month.to_s}/#{Time.now.day.to_s}/#
> > > > > > {Time.now.year.to_s}"
>
> > > > > > # open the IE browser
> > > > > > $ie = Watir::IE.new
> > > > > > $ie.speed = :fast
> > > > > > #  go to the selected MA site
> > > > > > $ie.goto($test_site)
>
> > > > > > class TestSuite < Test::Unit::TestCase
> > > > > >     include Watir::Assertions
>
> > > > > >     #login with the supplied producer username and password
> > > > > >     def test_00Login
> > > > > >         if $runTests['login'] == 'Yes'
> > > > > >             if $ie.text.include?('Inspection Search Results')
> > > > > >                 login($Username, $Password)
> > > > > >             else
> > > > > >                 puts 'The user was already logged in when the
> > > > > > application was opened.'
> > > > > >             end
> > > > > >         else
> > > > > >             puts ' '
> > > > > >             puts 'You chose not to run the user login test.'
> > > > > >         end
> > > > > >     end
> > > > > >     #Search records
> > > > > >     def Searchrecord_ponumber
> > > > > >     myData.each do |record|
> > > > > >    $ie.link(:href, "http://www.searchrecord/SearchInit.do";).click
> > > > > >    $ie.button(:name, "clearCriteriaBtn").click
> > > > > >    $ie.radio(:index, 2).set
> > > > > >    $ie.text_field(:name, "policyNumber").set(record['PoNumber'])
> > > > > >    $ie.button(:name, "submitBtn").click
>
> > > > > >    if $ie.contains_text(record['ContainsText'])
> > > > > >     puts "Results of search: '#{record['PoNumber']}' contains 
> > > > > > '#{record
> > > > > > ['ContainsText']}'"
> > > > > >    else
> > > > > >     puts "Error: could not find text: '#{record['ContainsText']}' in
> > > > > > results of search: '#{record['PoNumber']}'"
> > > > > >    end
> > > > > >    sleep 3
> > > > > >    #~ ie.close
> > > > > >    end
> > > > > >     end
> > > > > > end
>
> > > > > > Error message:
>
> > > > > > Testrun.rb:37:
> > > > > > ./Xls.rb:226:in `getWorksheet': getWorksheet(sheet=Setup) --> Sheet
> > > > > > 'Setup' COULD NOT BE FOUND (RuntimeError)
> > > > > >         from ./Xls.rb:193:in `getRange'
> > > > > >         from ./Xls.rb:104:in `get2DArray'
> > > > > >         from ./Xls.rb:145:in `getHash'
> > > > > > undefined method `close' for nil:NilClass (NoMethodError)- Hide 
> > > > > > quoted text -
>
> > > > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to