|
>> Does anyone know of a better way to do this? I was chewing on
possibly creating a 'order_something' object that could insert the proper steps
and assertions based on the 'store' that it's testing - but to >> be
honest I'm not even sure how to do that. Also, maybe this is a place where
exceptions should be used - I don't think so, but I don't know. Any ideas?
Hi Terry,
I think your on the right path with this thought.
Perhaps create one main Store object with characteristics common to all Stores
(ie logon, user name, password, account number) and then have child Stores
inherit from the parent Store object with more specific charactersitics. You
then initialize each Store accordingly and define them only in the specific test
case they are needed.
As you'll probably see, there are many ways to
approach this. How i have approached something
like this in the past is would be to give each Store object a "setup" and
"test" method, which is then called from within the specific test cases. This
way, your main test file would be tiny. You can then write your individual test
script as a method inside your Store objects. I don't know if this will help you
cut down on the amount of code you need to write
class OrderTest < Test::Unit::TestCase
def setup end
def test_store_01 store_1 =
Store.new(..)
store_1.setup()
assert
(store_1.test().....
end
def test_store_02
store_2=
Store.new(..)
store_2.setup()
assert
(store_1.test().....
end
def test_store_03
store_3=
Store.new(..)
store_3.setup()
assert
(store_1.test().....
end
def teardown end end Hope that helps.
Steve Tang
|
_______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general
