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)

--~--~---------~--~----~------------~-------~--~----~
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