Doing the Web Test in 3 acts with Watir

In a Story or UseCase for Web Application you can decompose a test into 3 acts. or Steps. (Actually I don’t like to speak of Preconditions and Steps. I much rather speak of Context and Acts in a Web Application testing).

class ThreeStepTest
  attr_accessor :context

  # config context for the test
  def initizlie(context)
     @context = context
  end

  # act one
  def set_request
    # given context configure the page with data.
    # Delegate to watir implementer here to send data to the page.
  end

  # act two
  def submit_request
    # delegate to watir to click on a page to submit form or request next page
  end

  # act three
  def verify_response
    # get context
    @context =
  end
end

class Context
  attr_accessor :given, :expected, :actual

end

the set_request occurs in a Given Context which was created by the previous verify_response.

So a test scenario can be constructed a series of those 3 acts. Context has a :given as a precondition to start with, :expected and :actual.

Anyway, this is just some thinking about constructing Watir framework

Post a Comment

You must be logged in to post a comment.