wofockham edited this page Aug 4, 2013 · 3 revisions

#Intro You've probably been there. You're building your killer Web Application. You, being a responsible developer, your code is thoroughly tested. You are using the likes of cucumber and Rspec to do so. Besides your unit-tests, you also have integration tests doing a full stack test. You are using Capybara to read, parse and test the rendered pages. You use all kinds of selectors to select different parts of the page. Slowly but surely your test code becomes less and less readable.

##PageRecord can help. There are a lot of ways you can do this. PageRecord is one of these ways. PageRecord is an ActiveRecord like abstraction for information on the HTML page.

##Use cases PageRecord has a couple of use cases.

  • create a record using the form elements (See create a record).
  • Check if the record is succesfully created (See test if exists)
  • Check for validation errors (See validation)
  • Follow a link to an other page or goto the next set of records. Check other actions to see how to do this.

##How make your HTML page PageRecord needs some specially formatted HTML5 pages. But don't worry. We've done the heavy lifting for you.

##Using it with Rspec and cucumber Check how to use it for instructions on how to us it with Rspec or Cucumber.

##How to use the API There is very little you have to do to use the PageRecord API. Just like Rails](http://rubyonrails.org/), PageRecord make heavy use of convention over configuration.

##How does it work under the cover PageRecord comes with helpers for Rails. But you can use PageRecord also for other Web frameworks. The special HTML5 tagging is simple and straightforward. See markup for more information on the markup.

##When it doesn't work out When it doesn't work out you can use these tools to make it happen:

  • Use the Selenium driver and pause the execution of your code. Use the page inspector to see what's on the page.
  • Use the PageRecord inspector to see what information your pages and your records contain.