Towards MVC framework for Watir Tests
I was thinking about what I call FUNTOM but more and more I call it Semantic Test Objects. Here is my example unofolding towards an MVC type framework for using Watir as my view through some adapters.
#example of class as Semantic Test Object which has mixing of module providing behaviour.
# This sould be a strategy pattern type thinking but who knows.
# it's just my investigations into watir implementation
module DefaultBehavior
def wag
puts 'default wag left to right'
# here call Watir Adapters to delegate actions to the webpage
end
def bark
puts 'woof woof default bark'
end
end
module SpecialBehavior
include DefaultBehavior
def bark
puts 'raah raah special bark'
end
end
class DogAsTestModel
include DefaultBehavior
end
DogAsTestModel.new.wag
DogAsTestModel.new.bark
class DogAsTestModel
include SpecialBehavior
end
DogAsTestModel.new.wag
DogAsTestModel.new.bark
class DogAsTestModel
include SpecialBehavior
def bark
puts 'overwrite bark. Woooooof Woooooof'
end
end
DogAsTestModel.new.wag
DogAsTestModel.new.bark
The idea is that class represents Semantic Test Object. It could be a collection of objects on a page.
more to come I hope.
Post a Comment
You must be logged in to post a comment.