Skip to content
/ futile Public

lightweight functional/blackbox/acceptance testing package for web pages

Notifications You must be signed in to change notification settings

obrok/futile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

= What is Futile?
Futile aims to be a cross-platform, cross-framework, robust and lightweight
functional testing package for web pages.

And yes, we _deliberately_ used those buzzwords.

= Why should I use it?
For a hypothetical users of your website the most important thing is that it
works. They don't care wether your #authorize method returns instance of user or
an integer. They don't give a damn about it! They want to see the page, type in
their login/password and see their profile. That's it. Easy as it sounds.

== What is wrong with <your framework here> functional tests
Imagine you have a registration form. It is very simple, includes login and two
password fields (one real and one to confirm). Within Rails you might do
something like this:
 def test_registers
   assert_difference(User, :count) do
     post(register_user_path,
            {:user => {:login => "msq", :password => "test",
               :password_confirmation => "test"}})
   end
   # more assertions here...
 end
The test passes, you are happy.
Now go to your registration form and change the name of login field to :log_in.
The test passes again. But the registration is not working! User is unable to
register which seems to be a serious bug.

Also the #register_user_path method might be considered wrong. Remember that
users type in your page address and it's probably the last thing they type into
address bar -- unless they are *leaving* your page. The rest happens through <a>
and <button>/<input> interface!

This proves the main flaw of built-in functional tests for frameworks -- they
don't test views. They do render them but nothing more. Remember -- view is the
*only* interface endusers see when they visit your webpage. They only click
links, fill fields and that's it!

= Installation
 $ sudo gem install futile

= Usage
We provide you with a tool that will help you test your site from a view of
enduser. You will be able to click buttons, type fields and do thing a regular
user would do on your site.

== Show me some examples
Let's say we want to test google. We want to be sure that the search results are
ok, that the page is shown and such.

 require "rubygems"
 require "futile"

 g = Futile::Session.new("http://www.google.com")
 g.get("/")               # (1)
 g.fill("q", "google")    # (2)
 g.click_button("Search") # (3)

== What happens here?
* (1) will make sure your response was valid (not a 5xx)
* (2) takes care to check that "q"-named input exists
* (3) checks that submit field "Search" is present and sends the form
  associated with it (including your newly _typed_ values)

= JavaScript
No. This tool supports *only* html, no browser (as Firefox or Safari) is
available so you are not able to test JS.

= Authors
Futile is developed by
* Michal Bugno
* Pawel Obrok

If you would like to contribute feel free to contact us.

About

lightweight functional/blackbox/acceptance testing package for web pages

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages