I am new into watir and I am using testunit for assertion. My script looks like this: Script1 -- has a test method which calls Script2 Script2 -- does all the work and validation. This has all assertion
When i run my test case I have to run Script1, it runs successfully but result shows 1 tests, 0 assertions, 0 failures, 0 errors, 0 skips.
Here is my code:
This is in my first file
require_relative 'RubyDriver'
require 'test/unit'
class RubyTest < Test::Unit::TestCase
def test_method
driver = RubyDriver.new("/home/pratik/study/UIAutomation/WatirScript.xlsx")
driver.call_driver
end
end
And this is part of anotner file
require_relative 'ExcelReader'
require_relative 'RubyUtility'
require "watir-webdriver"
require 'test/unit'
class RubyDriver < Test::Unit::TestCase
def take_action
value_property = @rubyutil.get_property("#{value}")
if value_property
value_prop = value_property.first.strip
value_value = value_property.last.strip
end
case "#{@rubyutil.get_string_upcase("#{keyword}")}"
when "VERIFY"
puts "verifying"
puts value_prop
puts value_value
object.wait_until_present
object.flash
if value_prop == "text"
assert_equal(object.text, value_value,"Text does not match")
# puts object.text.should == value_value
elsif value_prop == "exist"
value_boolean = value_value == "true" ? true : false
assert_equal(object.exists?,value_boolean,"Object does not exist")
# puts object.exists?.should == value_value
end
Everything is working fine except report which shows as
1 tests, 0 assertions, 0 failures, 0 errors, 0 skips.
Where is my number of assertions.
Any help please.