Home arrow Ruby-on-Rails arrow Commands for Acceptance Testing
RUBY-ON-RAILS

Commands for Acceptance Testing


In this second part of a three-part article series on acceptance testing with Ruby on Rails, you will learn the various commands that are performed during this process, and start your first acceptance test. This article is excerpted from chapter 11 of the book Practical Rails Projects, written by Eldon Alameda (Apress; ISBN: 1590597818).

Author Info:
By: Apress Publishing
Rating: 5 stars5 stars5 stars5 stars5 stars / 1
July 29, 2010
TABLE OF CONTENTS:
  1. · Commands for Acceptance Testing
  2. · Accessor Commands
  3. · Element Locators
  4. · The First Acceptance Test

print this article
SEARCH DEVARTICLES

Commands for Acceptance Testing
(Page 1 of 4 )

Assertion Commands

Assertions, or checks, verify that the state of the application is as expected after one or more actions have been executed by Selenium. For example, you can test that the title of the page or the value of a variable is correct.

Assertions are split into three groups that behave somewhat differently:

  1. Assertions (assert) abort the test if they fail.
  2. Verifications (verify) log the error and allow the test to continue. 
     
  3. Wait for (waitFor) assertions wait for the specified event to happen. They can be used for testing Ajax functionality. For example, you can wait for the value of an element on the page to be updated by an Ajax request.

Table 11-2 shows a partial list of supported Selenium assertions.

Table 11-2. Commonly Used Selenium Assertions  

 

 

Name

Description

assertLocation (location)

Asserts the location of the currently loaded page; for example, that itís /forumand not /catalog

assertTitle(title)

Asserts that the title of the currently loaded page is correct

assertTextPresent(text)

Asserts that the specified text is present on the page

 

 

Verification and wait for assertions use the same format. Use verifyLocation(/forum) to verify that the location is /forum, and use waitForLocation(/forum) to wait for that page to be loaded.


blog comments powered by Disqus
RUBY-ON-RAILS ARTICLES

- Ruby-on-Rails Faces Second Security Flaw in ...
- Ruby 2.0 Prepped for February 2013 Release
- Why LinkedIn Switched from Ruby on Rails
- Adding Style with Action Pack
- Handling HTML in Templates with Action Pack
- Filters, Controllers and Helpers in Action P...
- Action Pack and Controller Filters
- Action Pack Categories and Events
- Logging Out, Events and Templates with Actio...
- Action Pack Sessions and Architecture
- More on Action Pack Partial Templates
- Action Pack Partial Templates
- Displaying Error Messages with the Action Pa...
- Action Pack Request Parameters
- Creating an Action Pack Registration Form

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials