Ruby-on-Rails
  Home arrow Ruby-on-Rails arrow Acceptance Testing
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
RUBY-ON-RAILS

Acceptance Testing
By: Apress Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2010-07-23

    Table of Contents:
  • Acceptance Testing
  • Installing Selenium
  • Writing Selenium Tests
  • Action Commands

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Acceptance Testing


    (Page 1 of 4 )

    If you've built a complicated application and you want to make sure it works, you perform acceptance testing. This three-part article series will show you how to automate the process. It is excerpted from chapter 11 of the book Practical Rails Projects, written by Eldon Alameda (Apress; ISBN: 1590597818).

    In this chapter, you will learn how to automate acceptance tests. Acceptance tests are important, since they prove that the system works according to the requirements.

    Throughout this book, George has been performing acceptance testing quite haphazardly by randomly testing that the user stories we have implemented work as he intended. This is better than no acceptance tests at all, but since we're building an e-commerce site, we want to be absolutely sure that everything works all the time. We don't want to lose a customer by providing a service that doesn't work as expected, and George doesn't have the money to hire a dedicated tester. This is where Seleniuman-- open source testing tool originally developed as an in-house project at ThoughtWorks--comes in handy.

    With Selenium and the Selenium on Rails plugin, you can automate acceptance tests that otherwise would be performed manually, or more likely, not at all. You can run the automated acceptance tests when, for example, you refactor code or release a new version. This raises your comfort level by giving you immediate feedback when something breaks.

    Using Selenium

    The core of Selenium, referred to as Selenium Core, is implemented as JavaScript that runs directly inside your browser, unlike other similar tools like Fitnesse, which run in a separate process. This allows scripts written using Selenium to issue commands like mouse clicks and other actions that mimic the real interaction between a user's browser and a web application. We can, for instance, write a script that simulates George accessing the Emporium forum, filling out the form on the new post page, and then clicking the submit button. Selenium can also check whether the request was successful by, for example, checking that the next page displays the expected content. All these actions are done through Selenium commands, which we'll go through in the "Writing Selenium Tests" section later in this chapter.

    Selenium on Rails (http://www.openqa.org/selenium-on-rails), a plugin developed by Jonas Bengtsson, integrates Selenium into the Rails framework. The plugin provides many features to simplify the use of Selenium with Rails. For example, it does the following:

    1. Creates test suites automatically from tests that are located in the same directory. For example, storing a test in test/selenium/authentication/test_login.sel would automatically make the test (test_login.sel) belong to the authentication test suite. 
       
    2. Deploys Selenium to the test environment automatically. (Selenium is not deployed to the development or production environments by default.) 
       
    3. Allows you to write Selenium tests in ERB, Selenese, or RSelenese, rather than just HTML.
       
    4. Lets you place the Selenium files in a directory other than /public. Selenium can be located in /vendor/selenium or the RubyGems repository. 
       
    5. Allows for the use of fixtures in Selenium tests and clearing sessions. Fixtures are run by accessing the URL /selenium/setup from acceptance tests.

    More Ruby-on-Rails Articles
    More By Apress Publishing


     

    RUBY-ON-RAILS ARTICLES

    - Application Deployment with Capistrano
    - Deploying an Application to the Server
    - Secure Application Deployment with Ruby on R...
    - Installing the Database for Application Depl...
    - Application Deployment
    - Recording Acceptance Tests
    - Commands for Acceptance Testing
    - Acceptance Testing
    - Checkout and Order Processing: the User Side
    - Checkout and Order Processing: the Administr...
    - Online Order Processing: Using PayPal
    - Order and Payment Handling for an Ecommerce ...
    - Checkout and Order Processing for an Ecommer...
    - Getting Text and Currency Working for Multip...
    - Translating a Site for Multiple Language Sup...







    © 2003-2010 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek