A
aidy
Hi,
I use Watir and Test::Unit.
There are a number of sites I test that are very similar.
I have a base test unit script e.g.
class Main_Site_Test < Test::Unit::TestCase
include Watir::Assertions
def setup
@browser = Project::Browser.new
@register = Project::Register.new
@home = Project::HomeExceptions.new
@login = {:url=> 'main_site.com'}
end
def test_0002_login
@browser.goto(@login[:url])
@home.log_in_link.click
@home.username_edit.set('(e-mail address removed)')
@home.password_edit.set('pass123')
@register.go_button.click
verify(@browser.include('Welcome'), 'not logged in successfully')
rescue => e
@browser.close
end
So for the next site I will do this
class Similar_Test < Main_Site_Test
def setup
super
@login = {:url=> 'similar_test.com'}
end
end
However, I can't run the Similar_Test class without running the
Main_Site_Test class
require 'main_site_test'
require 'similar_test'
Also, I have written 'test_0002_login', can I not just use that
specific method in different test classes?
Any suggestions?
Aidy
I use Watir and Test::Unit.
There are a number of sites I test that are very similar.
I have a base test unit script e.g.
class Main_Site_Test < Test::Unit::TestCase
include Watir::Assertions
def setup
@browser = Project::Browser.new
@register = Project::Register.new
@home = Project::HomeExceptions.new
@login = {:url=> 'main_site.com'}
end
def test_0002_login
@browser.goto(@login[:url])
@home.log_in_link.click
@home.username_edit.set('(e-mail address removed)')
@home.password_edit.set('pass123')
@register.go_button.click
verify(@browser.include('Welcome'), 'not logged in successfully')
rescue => e
@browser.close
end
So for the next site I will do this
class Similar_Test < Main_Site_Test
def setup
super
@login = {:url=> 'similar_test.com'}
end
end
However, I can't run the Similar_Test class without running the
Main_Site_Test class
require 'main_site_test'
require 'similar_test'
Also, I have written 'test_0002_login', can I not just use that
specific method in different test classes?
Any suggestions?
Aidy