Skip to content


Subversion checkout URL

You can clone with
Download ZIP


vivnet edited this page · 4 revisions
  • Flows move through a Site’s Pages
  • Flows help DRY up test code
  • Flows can take a hash to pass in values

If you had the following code in a whole lot of places in your tests: do |google|
  google.home_page do |home_page|
    home_page.search_field.set "ruby ruby ruby"

Then it would make sense to pull this out into a method, but methods could have multiple intentions. In this case the abstract intention is to move through the Google site. Taza provides the convention of flows. To pull out the above code into a flow perform the following steps(assuming you’ve created a google Sites already):

  1. $ ./script/generate flow search google
  2. open ./lib/sites/google/flows/search.rb
  3. Do something like
    module Google
      class Google < ::Taza::Site
        def search_flow(params={})
          home_page.search_field.set params[:query]

  4. Rip out the duplicated code and replace it with the flow call do |google|
      google.search_flow :query => "ruby ruby ruby"


Flows tend to work best not to hide code or DRY it up, but rather to express steps of a test which are not important to the actual tests assertion point. For example, if you want to test the Google Search Results page then it is important to know that a search must be performed but not necessarily how it is performed. Sometimes it is best to keep test code moist instead of completely DRY.

Something went wrong with that request. Please try again.