Skip to content
Browse files

README update

  • Loading branch information...
1 parent ce5cb2f commit d88280c84334526026fe178a72d24452ab63f283 @epall committed
Showing with 16 additions and 9 deletions.
  1. +16 −9 README.md
View
25 README.md
@@ -1,7 +1,7 @@
-test_right: Opinionated full-stack browser testing
+Test::Right - Opinionated full-stack browser testing
=================================================
-test_right is a testing framework designed to help users get maximum value out
+Test::Right is a testing framework designed to help users get maximum value out
of browser testing.
Setup
@@ -18,10 +18,10 @@ 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_ on _widgets_. A widget is a piece of
-functionality present on one more more pages of your applicaiton. A single
-page can have many widgets, and multiple copies of a widget may appear on the
-same page.
+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 write tests, start by adding widgets in the widgets/ directory. A widget
defines its elements in terms of standard Selenium 2 selectors and actions in
@@ -32,12 +32,20 @@ test/right/widgets/login.rb.
field :username, :id => 'username'
button :login, :xpath => "//input[@type='submit']"
- def login(username, password)
+ 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, you can test features by adding files in
test/right/features/. For example, test/right/features/shopping_cart.rb:
@@ -52,8 +60,7 @@ test/right/features/. For example, test/right/features/shopping_cart.rb:
end
with CartWidget do |w|
- assert {
- w.number_of_items == 1
+ assert_equal, 1, w.number_of_items
end
end
end

0 comments on commit d88280c

Please sign in to comment.
Something went wrong with that request. Please try again.