1 / 36

Continuous Validation: Pursuing Error-Free Apps

Continuous Validation: Pursuing Error-Free Apps. Dane Avilla Avilla Software. Biography. 10+ years software development 5+ years web development 2+ years Ruby/Rails. Overview. Goals: Why test Strategies: Which approach Tactics: How to succeed Config & Demo Questions. Web App Output.

bpowe
Télécharger la présentation

Continuous Validation: Pursuing Error-Free Apps

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Continuous Validation:Pursuing Error-Free Apps • Dane Avilla • Avilla Software

  2. Biography • 10+ years software development • 5+ years web development • 2+ years Ruby/Rails

  3. Overview • Goals: Why test • Strategies: Which approach • Tactics: How to succeed • Config & Demo • Questions

  4. Web App Output • For humans • For machines

  5. Broken machine-readable code breaks human-readable display

  6. Current state-of-art testing • Human output: much effort • Machine output: little (no) effort

  7. Consequences • Browser differences • Scalability • Productivity loss • Customer frustration

  8. Web App == Code Generator • Input (HTTP GET/POST) • Output • HTML • CSS • JS

  9. Two questions • Is output valid? • Does browser display output correctly? • (Ask these questions in this order!)

  10. Solution • Validate Output • onsgmls, csslint, JSLint/JavaScript Lint • Difficult: bad docs, no single tool • Validate browser behavior (esp. for Ajax) • Human testing (waste of time) • Browser automation

  11. How?

  12. Strategies • Infrastructure-level • App-level • Client-level

  13. Infrastructure-Level

  14. Infrastructure-Level

  15. App-Level • Rails ‘after’ filters • Integrate with validation tools • Run when RAILS_ENV == :test

  16. Client-Level • Browser Plug-In: http://addons.mozilla.org • HTML Validator • Relaxed the HTML Validator • Web spider/robot • Web Application Testing in Ruby (WATiR) • http://wtr.rubyforge.org • http://watir-on-rails.rubyforge.org

  17. Tactics @ RubyForge • RaiLint • Lint for Rails • App-Level • DWatir • Distributed WATiR • Client-Level • RaiLint and DWatir are written by Dane G. Avilla

  18. RaiLint @ RubyForge.org • App-level: Rails filters • Depends on (free) external tools • onsgmls: http://openjade.sourceforge.net • csslint: http://jigsaw.w3.org/css-validator • JavaScript Lint: http://www.javascriptlint.com • Removes most configuration headaches • java, onsgmls, and jsl must be on $PATH

  19. RaiLint: App-Level • Adds filters to ActiveController::Base • Delegates to onsgmls, csslint, and JavaScript Lint • Validates (X)HTML, CSS, and JS • Adds rake test tasks to check .html, .js, and .css under $RAILS_APP/public

  20. DWatir & Mofo: Client-Level • DWATiR • “Distributed Web Application Testing in Ruby” • Based on Rinda & Watir/SafariWatir/FireWatir • Central registry • Multi-browser/platform testing • Mofo: Microformats at http://mofo.rubyforge.org

  21. Config & Demo • Sudoku Solver • App-Level • Client-Level

  22. RaiLint: App-Level • Install to vendor/plugins/railint • Adds rake tasks (rake --task | grep railint) • From $RAILS_APP, run rake railint:config:all • Examples in $RAILINT_DIR/test • Sample errors: in $RAILINT_DIR, run rake --task • Override default JavaScript Lint config (jsl.conf) with $RAILS_APP/config/jsl.conf

  23. Demo: RaiLint App-Level

  24. DWatir: Client-Level

  25. DWatir: Client-Level

  26. DWatir: Client-Level

  27. DWatir: Client-Level

  28. DWatir: Client-Level

  29. DWatir: Client-Level

  30. Demo: Client-Level

  31. Automate it all • RaiLint + DWatir • require ‘railint_test’ in a TestCase • Starts WeBrick in test mode when TestSuite starts • Shuts down WeBrick when TestSuite ends

  32. Demo

  33. Microformats for Testing • Subclass Microformat • Markup HTML output • Use API for testing expected output • “Free” customer API • NIH, but good technique

  34. Microformat Implementation • require 'microformat' • class MicroRestaurant < Microformat one :id, :name, :phonenumberend • <div class="microrestaurant"> <span class="id">3</span> <span class="name">Obelisk</span> <span class="phonenumber">202-555-1414</span></div> • r = MicroRestaurant.find(:all => {:text => html_str}) =><#MicroRestaurant @id=“3” @name=“Obelisk” …>

  35. Questions?

  36. Thanks!

More Related