Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

test_right

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

test_right

  • 0.2.1
  • Rubygems
  • Socket score

Version published
Maintainers
2
Created
Source

Test::Right - Opinionated full-stack browser testing

Test::Right is a testing framework designed to help users get maximum value out of browser testing. It provides a flexible Page Object model for building robust, reliable tests quickly and easily. No more slogging through XPaths in Selenium IDE: Test::Right is the right way to build browser tests.

Setup

gem install test_right
cd MY_APP
test_right install

The test_right executable will create a default directory structure in test/right for you to put your tests in.

Begin by setting the base_url setting in test/right/config.yml to the base URL of your application staging environment. Then add the necessary code to reset your application state and launch your server to setup.rb.

Tests are defined in terms of actions and properties on widgets. A widget is a piece of functionality present on one more more pages of your application. A single page can have many widgets, and multiple copies of a widget may appear on the same page.

To get started, add widget definitions to the widgets/ directory. A widget defines its elements in terms of standard Selenium 2 selectors and actions in terms of those elements. For example, something like this in test/right/widgets/login.rb:

class LoginWidget < Test::Right::Widget
  field :username, :id => 'username'
  button :login, :css => "input[type=submit]"

  action :login |username, password|
    fill_in :username, username
    click :login
  end
end

class CartWidget  < Test::Right::Widget
  element :count, :id => 'item_count'

  property :number_of_items do
    get_element(:count).text
  end
end

Once your widgets are setup, write tests for features of your application in test/right/features. For example, something like this would go in test/right/features/shopping_cart.rb:

class ShoppingCartFeature < Test::Right::Feature
  def setup
    with LoginWidget do |w|
      w.login
    end
  end

  def test_adding_item
    with ItemWidget do |w|
      w.add_an_item
    end

    with CartWidget do |w|
      assert_equal, 1, w.number_of_items 
    end
  end
end

Learn more on the Test::Right wiki at https://github.com/saucelabs/test_right/wiki

FAQs

Package last updated on 05 May 2011

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc