Home arrow Ruby-on-Rails arrow Page 2 - 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 - Accessor Commands
(Page 2 of 4 )

Accessors are used for accessing the content that is displayed in the browser and for storing the content in a variable that can be used later in the script. Accessors follow the same logic as verification and wait for assertions. For example, use storeLocation(variableName) to store the title of the page in a variable. Table 11-3 lists some commonly used accessors.

Table 11-3. Commonly Used Selenium Accessors

Name Description
store(value, variableName) Stores the value in the specified variable
storeValue(locator, variableName) Stores the value of an input field in the specified variable
storeText(locator, variableName) Stores the text of the specified element in the specified variable
storeChecked(locator, variableName) Stores true in the specified variable if the check box is selected, otherwise stores false

 

 

 

 

 

 

 

 

 

 

Let's say that you want to store the text that you entered in the Name field on the post to forum page (http://localhost:3000/forum/post) and use the same text in the Subject field. You could do that with the following commands:

|open|/forum/post||
|type|post[name]|George|
|storeValue|post[name]|name|
|type|post[subject]|This is posted by ${name}|

The first two commands open the post to forum page and type George in the Name field. The third command stores the field's value in a variable (name), which is then used on the last row to type the text "This is posted by George" in the Subject field.


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-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials