Views Testing

Hello Champs,

Can anyone tell me that from where should i start for testing views of my application ? Want to know every possible way.

Thanks in advance :slight_smile:

Is there anyone who can help me with it ..?

One more issue, How can i check redirection of a page in integration testing.. Scenario is- I have a search page "/home" where i have to fill values in my search box fields and after i hit submit it'll post to the "/home/search" page with the results coming out respective to the search texts. Hope you people got me right.

Currently i am doing this, post "/home/search" post_variable_names Also tried: post_via_redirect "/home/search" post_variable_names

But both of them are not working.. :cry:

Hemant Bhargava wrote:

Hemant Bhargava wrote:

Hello Champs,

Can anyone tell me that from where should i start for testing views of my application ?

Well, you can use RSpec (preferably with rspec_hpricot_matchers) to test the generated HTML, or you can do what I've been doing lately: not writing much in the way of view specs, and instead letting my Cucumber features exercise the views.

Want to know every possible way.

And you think you're going to find out every possible way from list postings? Come on!

Thanks in advance :slight_smile:

Best,

Ok fine ..

Can you tell me the second query as well.. ?

Marnen Laibow-Koser wrote:

You also can try Selenium (http://seleniumhq.org/), webrat (http:// agilewebdevelopment.com/plugins/webrat), or watir (http://watir.com/) if you want simulate browser behavior and/or test javascript.

I would recommend starting by working through the Rails Guide on testing at http://guides.rubyonrails.org which includes testing views. This shows how to use the basic testing facilities provided by rails. Many (including myself) believe that additional tools mentioned by others in the thread, such as rspec, are significant improvements on the built in testing tools but I think it is useful to understand the basics as described in the tutorial before going on to better things.

Colin

Hi Guyz,

Thanks a lot for your support .. Resolved it .. But now i have got another issue regarding ferret engine. Posting it in new thread.

Colin Law wrote: