# Views Testing

**URL:** <https://www.ruby-forum.com/t/views-testing/181877>\
**Category:** Rails\
**Created:** [January 19, 2010, 4:42pm UTC](https://www.ruby-forum.com/t/views-testing/181877 "2010-01-19T16:42:57Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![hemantborole](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b782af/32.png) [@hemantborole](https://www.ruby-forum.com/u/hemantborole)\
**Post date:** [January 19, 2010, 4:42pm UTC](https://www.ruby-forum.com/t/views-testing/181877/1 "2010-01-19T16:42:57Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![hemantborole](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b782af/32.png) [@hemantborole](https://www.ruby-forum.com/u/hemantborole)\
**Post date:** [January 20, 2010, 7:43am UTC](https://www.ruby-forum.com/t/views-testing/181877/2 "2010-01-20T07:43:30Z")

</div>

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… :’(

Hemant B. wrote:

> 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 🙂

---

<div class="post-metadata">

**Author:** ![hemantborole](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b782af/32.png) [@hemantborole](https://www.ruby-forum.com/u/hemantborole)\
**Post date:** [January 20, 2010, 8:01am UTC](https://www.ruby-forum.com/t/views-testing/181877/3 "2010-01-20T08:01:14Z")

</div>

Hemant B. 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 🙂

Best,  
–Â  
Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![hemantborole](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b782af/32.png) [@hemantborole](https://www.ruby-forum.com/u/hemantborole)\
**Post date:** [January 20, 2010, 11:39am UTC](https://www.ruby-forum.com/t/views-testing/181877/4 "2010-01-20T11:39:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![hemantborole](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b782af/32.png) [@hemantborole](https://www.ruby-forum.com/u/hemantborole)\
**Post date:** [January 20, 2010, 8:12am UTC](https://www.ruby-forum.com/t/views-testing/181877/5 "2010-01-20T08:12:56Z")

</div>

Ok fine …

Can you tell me the second query as well… ?

Marnen Laibow-Koser wrote:

> Hemant B. wrote:

> And you think you’re going to find out every possible way from list  
> postings? Come on!
> 
> > Thanks in advance 🙂
> 
> Best,  
> –Â  
> Marnen Laibow-Koser  
> [http://www.marnen.org](http://www.marnen.org)  
> removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![hemantborole](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b782af/32.png) [@hemantborole](https://www.ruby-forum.com/u/hemantborole)\
**Post date:** [January 20, 2010, 11:52am UTC](https://www.ruby-forum.com/t/views-testing/181877/6 "2010-01-20T11:52:16Z")

</div>

2010/1/19 Hemant B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

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

I would recommend starting by working through the Rails Guide on  
testing at [http://guides.rubyonrails.org](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

---

<div class="post-metadata">

**Author:** ![hemantborole](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b782af/32.png) [@hemantborole](https://www.ruby-forum.com/u/hemantborole)\
**Post date:** [January 20, 2010, 3:32pm UTC](https://www.ruby-forum.com/t/views-testing/181877/7 "2010-01-20T15:32:50Z")

</div>

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 L. wrote:

> 2010/1/19 Hemant B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):
> 
> > Hello Champs,
